diff --git a/CHANGELOG.md b/CHANGELOG.md index a22f3f3bf..e565e393e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Improvements -* `selectize`, `remove_button`, and `options` parameters of `ui.input_select()` have been deprecated; use `ui.input_selectize()` instead. (Thanks, @ErdaradunGaztea!) (#1947) +* `selectize`, `remove_button`, and `options` parameters of `ui.input_select()` have been deprecated; use `ui.input_selectize()` instead. (Thanks, @ErdaradunGaztea!) (#1947) * Improved the styling and readability of markdown tables rendered by `ui.Chat()` and `ui.MarkdownStream()`. (#1973) ### Bug fixes +* Fix missing session when trying to display an error duing bookmarking. (#1984) + ## [1.4.0] - 2025-04-08 diff --git a/shiny/bookmark/_bookmark.py b/shiny/bookmark/_bookmark.py index 28abdb139..bcff1d523 100644 --- a/shiny/bookmark/_bookmark.py +++ b/shiny/bookmark/_bookmark.py @@ -436,7 +436,7 @@ async def invoke_on_restored_callbacks(): except Exception as e: warnings.warn( f"Error calling on_restored callback: {e}", - stacklevel=2, + stacklevel=1, ) notification_show( f"Error calling on_restored callback: {e}", @@ -561,7 +561,12 @@ async def do_bookmark(self) -> None: msg = f"Error bookmarking state: {e}" from ..ui._notification import notification_show - notification_show(msg, duration=None, type="error") + notification_show( + msg, + duration=None, + type="error", + session=self._root_session, + ) class BookmarkProxy(Bookmark): @@ -806,27 +811,3 @@ def on_restored( ) -> CancelCallback: # Provide a no-op function within ExpressStub return lambda: None - - -# #' Display a modal dialog for bookmarking -# #' -# #' This is a wrapper function for [urlModal()] that is automatically -# #' called if an application is bookmarked but no other [onBookmark()] -# #' callback was set. It displays a modal dialog with the bookmark URL, along -# #' with a subtitle that is appropriate for the type of bookmarking used ("url" -# #' or "server"). -# #' -# #' @param url A URL to show in the modal dialog. -# #' @export -# showBookmarkUrlModal <- function(url) { -# store <- getShinyOption("bookmarkStore", default = "") -# if (store == "url") { -# subtitle <- "This link stores the current state of this application." -# } else if (store == "server") { -# subtitle <- "The current state of this application has been stored on the server." -# } else { -# subtitle <- NULL -# } - -# showModal(urlModal(url, subtitle = subtitle)) -# }