shiny icon indicating copy to clipboard operation
shiny copied to clipboard

Bookmarking bug (or documentation required): only last setBookmarkExclude() is respected

Open daattali opened this issue 6 years ago • 5 comments

I have an app with several inputs that have long names that I want to exclude from bookmarking. I didn't see anywhere in the documentation, online or in roxygen, that setBookmarkExclude() should only be called once, so I assumed I would be able to call the function many times in a row. It turns out that it overwrites the previous ones. So something like this

setBookmarkExclude("t1")
setBookmarkExclude("t2")
setBookmarkExclude("t3")

Will only exclude t3 from bookmarking. Either this is a bug, or it should be mentioned in the documentation that this will not work. Maybe it is mentioned somewhere and I just didn't see it!

daattali avatar Feb 07 '19 06:02 daattali

You can do this like so today:

setBookmarkExclude(c(session$getBookmarkExclude(), "t1")
setBookmarkExclude(c(session$getBookmarkExclude(), "t2")
setBookmarkExclude(c(session$getBookmarkExclude(), "t3")

Also, note that setBookmarkExclude only overwrites other calls to setBookmarkExclude within the same module--or, if called at the top-level server function, it overwrites other calls from the top-level server function.

jcheng5 avatar Jul 29 '20 02:07 jcheng5

This works too :joy:

moduleServer(NULL, function(input, output, session) {
  setBookmarkExclude("t1")
})
moduleServer(NULL, function(input, output, session) {
  setBookmarkExclude("t2")
})
moduleServer(NULL, function(input, output, session) {
  setBookmarkExclude("t3")
})

jcheng5 avatar Jul 29 '20 02:07 jcheng5

Eek. I agree with the tears part of the emoji, not with the smiling part.

daattali avatar Jul 29 '20 03:07 daattali

If I write a shiny app, then it is possible for me to list exclude all the IDs I want.

But what about as a package author? If I create inputs in a package, and I want any future user who writes a shiny app that uses my package to not include these inputs in their bookmarks, is there a way to achieve that?

daattali avatar Jan 16 '23 07:01 daattali

So what is the verdict here, is this a bug or a feature?

daattali avatar Apr 10 '25 18:04 daattali