diff --git a/NEWS.md b/NEWS.md index 0f8e53470..d70517d05 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,8 @@ * `dateInput` and `dateRangeInput` no longer send immediate updates to the server when the user is typing a date input. Instead, it waits until the user presses Enter or clicks out of the field to send the update, avoiding spurious and incorrect date values. Note that an update is still sent immediately when the field is cleared. (#3664) +* Fixed a bug in `onBookmark` hook that caused elements to not be excluded from URL bookmarking. (#3762) + # shiny 1.9.1 ## Bug fixes diff --git a/R/bookmark-state.R b/R/bookmark-state.R index e1c7e9c1d..467c055b5 100644 --- a/R/bookmark-state.R +++ b/R/bookmark-state.R @@ -99,13 +99,13 @@ saveShinySaveState <- function(state) { # Encode the state to a URL. This does not save to disk. encodeShinySaveState <- function(state) { - exclude <- c(state$exclude, "._bookmark_") - inputVals <- serializeReactiveValues(state$input, exclude, stateDir = NULL) - # Allow user-supplied onSave function to do things like add state$values. if (!is.null(state$onSave)) isolate(state$onSave(state)) + exclude <- c(state$exclude, "._bookmark_") + inputVals <- serializeReactiveValues(state$input, exclude, stateDir = NULL) + inputVals <- vapply(inputVals, function(x) toJSON(x, strict_atomic = FALSE), character(1),