Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookmarking bug: only the last setBookmarkExclude() is honoured, all previous excludes are ignored #2971

Closed
daattali opened this issue Jul 16, 2020 · 3 comments

Comments

@daattali
Copy link
Contributor

When calling setBookmarkExclude() multiple times, only the last call actually excludes the given inputs.

Example: There are 4 inputs in the app below, which are being excluded in two separate calls. When the bookmark button is clicked, the excluded inputs are printed, and you can see it's only the inputs from the last call.

library(shiny)

ui <- function(req) {
  fluidPage(
    bookmarkButton(),
    textInput("test1", "test1", "test1"),
    textInput("test2", "test2", "test2"),
    textInput("test3", "test3", "test3"),
    textInput("test4", "test4", "test4")
  )
}

server <- function(input, output, session) {
  setBookmarkExclude(c("test1", "test2"))
  setBookmarkExclude(c("test3", "test4"))
  
  onBookmark(function(state) {
    message(state$exclude)
  })
}

shinyApp(ui, server, enableBookmarking = "url")

I think it's because in this line the excluded inputs are being assigned/overrided instead of appended to a list. Is there a reason they can't be appended instead of overridden?

@jcheng5
Copy link
Member

jcheng5 commented Jul 28, 2020

This has caught me out as well. I think for now we'd need to use an add = TRUE like on.exit, but here's another case for shiny editions to let us change the default behavior in the future...

@jcheng5
Copy link
Member

jcheng5 commented Jul 28, 2020

LOL, dupe of your own issue #2323

@jcheng5 jcheng5 closed this as completed Jul 28, 2020
@daattali
Copy link
Contributor Author

Whoops :p My github issue searching skills are much weaker than my googling skills....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants