From eee35957ed50b8915f5ac124f2f5275e99d63161 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 29 Apr 2025 15:28:29 -0400 Subject: [PATCH 1/4] remove commented code --- shiny/bookmark/_bookmark.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/shiny/bookmark/_bookmark.py b/shiny/bookmark/_bookmark.py index 28abdb139..63fdb8c5a 100644 --- a/shiny/bookmark/_bookmark.py +++ b/shiny/bookmark/_bookmark.py @@ -806,27 +806,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)) -# } From 7b722a74f2850ff7f7378e6f14f28500868d47f9 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 29 Apr 2025 15:29:36 -0400 Subject: [PATCH 2/4] use known session when showing notification --- shiny/bookmark/_bookmark.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shiny/bookmark/_bookmark.py b/shiny/bookmark/_bookmark.py index 63fdb8c5a..7cc0820ec 100644 --- a/shiny/bookmark/_bookmark.py +++ b/shiny/bookmark/_bookmark.py @@ -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): From 8648008150782352b56ed7b72352f477fbfbec6c Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 29 Apr 2025 15:30:03 -0400 Subject: [PATCH 3/4] fix stacklevel for warning --- shiny/bookmark/_bookmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shiny/bookmark/_bookmark.py b/shiny/bookmark/_bookmark.py index 7cc0820ec..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}", From 1f5e41dc92ac5fb3b13f27baa0fc2da8610dcd8c Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 29 Apr 2025 15:37:50 -0400 Subject: [PATCH 4/4] update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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