-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Reactive selectizeInput box fail to update correctly in Shiny 1.8.0, first value of previous allowed choices are kept #3966
Comments
…cted` and `server = TRUE` Fixes #3966
Hi @Roleren, thanks for the bug report! One important detail: this only happens when We can do slightly better than the current situation when Here are two other options to get around this issue with released shiny:
|
Thanks, this should solve the issue for now. As far as I understand, the old value is still kept if selected is not specified ? |
…cted` and `sever = TRUE` (#3967) * fix(updateSelectizeInput): Clear current value before update if `selected` and `server = TRUE` Fixes #3966 * chore: yarn build * `yarn build` (GitHub Actions) * docs(news): Add news item * chore: Add comments for future selves Co-authored-by: Carson Sievert <[email protected]> * `yarn build` (GitHub Actions) --------- Co-authored-by: gadenbuie <[email protected]> Co-authored-by: Carson Sievert <[email protected]>
I'm not sure if #3967 fixed this. I'm still having the same issue as explained in the original post with shiny v1.8.1.1 and development version. |
@trangdata I just tried the reprex in the original post with shiny v1.8.1.1 and it worked for me as expected after #3967. If you're encountering a similar issue it might actually be a new or different problem. Can you please open a new issue with a reproducible example so we can take a look? |
I ran the same reprex with shiny v1.8.1.1. Maybe I can clarify what I see a little bit: When I first load the app, I have Numeric. I select libraries 1, 3, 5, then switch to Letters. Now, the selected library is A. However, when I click on the input box to select more libraries (expectedly only letters), I see 1, 3, 5 as options also. Maybe I'm missing something obvious?! |
I don't think it's that you missed something obvious, I had to re-read the issue again carefully to remember...
This part of the issue isn't fixed by #3967, because
My recommendation for solving this part of the problem was to
by adding the following to the server logic above the observeEvent(choices(), {
# Clear the selection before updating choices
updateSelectizeInput(
inputId = "library",
selected = NULL,
server = TRUE
)
}) |
Ah okay! Thank you for clarifying Garrick! I saw your workaround in the earlier comment but thought that #3967 fixed everything and I would not have to manually clear the selection before updating the choices. But it makes sense now. Thanks! |
This is actually a bug in selectize.js, you can observe similar behavior on https://selectize.dev/docs/demos/api. I've filed a ticket there: selectize/selectize.js#2146 |
* Work around a selectize bug (re-fixes #3966) --------- Co-authored-by: Garrick Aden-Buie <[email protected]>
System details
Browser Version:
Output of
sessionInfo()
:Example application or steps to reproduce the problem
Describe the problem in detail
A new bug in 1.8.0, I can verify that this does not happen in 1.7.4, which I had before I updated today.
When you have a box (library) with selectable numbers 1,2,3,4,5 and another box (selectID) that defines id type of box (library) (numeric is default or character: i.e. changes the selection in (library) to A,B,C,D,E.
The total allowed selection of (library) will not be A,B,C,D,E, but 1,A,B,C,D,E.
If you flip back to numeric, the allowed options are then: A,1,2,3,4,5
Even though you restrict the types on updateSelectizeInput, this is clearly ignored as the first value of previous allowed choices are kept
This breaks our app on www.Ribocrypt.org
The text was updated successfully, but these errors were encountered: