Skip to content

Commit c441a62

Browse files
authored
fix(bookmarking): Fix unknown session when displaying error (#1984)
1 parent 5cb608f commit c441a62

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Improvements
1313

14-
* `selectize`, `remove_button`, and `options` parameters of `ui.input_select()` have been deprecated; use `ui.input_selectize()` instead. (Thanks, @ErdaradunGaztea!) (#1947)
14+
* `selectize`, `remove_button`, and `options` parameters of `ui.input_select()` have been deprecated; use `ui.input_selectize()` instead. (Thanks, @ErdaradunGaztea!) (#1947)
1515

1616
* Improved the styling and readability of markdown tables rendered by `ui.Chat()` and `ui.MarkdownStream()`. (#1973)
1717

1818
### Bug fixes
1919

20+
* Fix missing session when trying to display an error duing bookmarking. (#1984)
21+
2022

2123
## [1.4.0] - 2025-04-08
2224

shiny/bookmark/_bookmark.py

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ async def invoke_on_restored_callbacks():
436436
except Exception as e:
437437
warnings.warn(
438438
f"Error calling on_restored callback: {e}",
439-
stacklevel=2,
439+
stacklevel=1,
440440
)
441441
notification_show(
442442
f"Error calling on_restored callback: {e}",
@@ -561,7 +561,12 @@ async def do_bookmark(self) -> None:
561561
msg = f"Error bookmarking state: {e}"
562562
from ..ui._notification import notification_show
563563

564-
notification_show(msg, duration=None, type="error")
564+
notification_show(
565+
msg,
566+
duration=None,
567+
type="error",
568+
session=self._root_session,
569+
)
565570

566571

567572
class BookmarkProxy(Bookmark):
@@ -806,27 +811,3 @@ def on_restored(
806811
) -> CancelCallback:
807812
# Provide a no-op function within ExpressStub
808813
return lambda: None
809-
810-
811-
# #' Display a modal dialog for bookmarking
812-
# #'
813-
# #' This is a wrapper function for [urlModal()] that is automatically
814-
# #' called if an application is bookmarked but no other [onBookmark()]
815-
# #' callback was set. It displays a modal dialog with the bookmark URL, along
816-
# #' with a subtitle that is appropriate for the type of bookmarking used ("url"
817-
# #' or "server").
818-
# #'
819-
# #' @param url A URL to show in the modal dialog.
820-
# #' @export
821-
# showBookmarkUrlModal <- function(url) {
822-
# store <- getShinyOption("bookmarkStore", default = "")
823-
# if (store == "url") {
824-
# subtitle <- "This link stores the current state of this application."
825-
# } else if (store == "server") {
826-
# subtitle <- "The current state of this application has been stored on the server."
827-
# } else {
828-
# subtitle <- NULL
829-
# }
830-
831-
# showModal(urlModal(url, subtitle = subtitle))
832-
# }

0 commit comments

Comments
 (0)