Comments (2)
Hi @Roleren, thanks for the bug report!
One important detail: this only happens when server = TRUE
. In this case, the full set of choices
are kept back on the server because they could be potentially large and are only sent to the client app when requested. If you completely change the available choices
, the client won't know that the current (about to be old) values are no longer valid, so it keeps those values as options.
We can do slightly better than the current situation when selected
is provided. I've just added a bit of code in #3967 that will clear the current value of the select input before performing the choices update when selected
is provided.
Here are two other options to get around this issue with released shiny:
-
Use fully client-side selectize inputs, i.e.
server = FALSE
. -
Manually clear the selection before updating the choices and current value, but having an
observeEvent()
that first clears the selection:choices <- reactive({ if (input$selectID == "Numeric") { as.character(seq(5)) } else { LETTERS[1:5] } }) observeEvent(choices(), { # Clear the selection before updating choices updateSelectizeInput( inputId = "library", selected = NULL, server = TRUE ) }) observeEvent(choices(), { updateSelectizeInput( inputId = "library", choices = choices(), selected = choices()[1], server = TRUE ) })
from 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 ?
from shiny.
Related Issues (20)
- Client error console prevents apps with matching input and output IDs
- Client error console and inserted/removed UI elements HOT 1
- Client error console issue with dynamic bslib accordions
- Should check for overlapping input and output binding IDs, and only enable error console in local development
- Unnesting an reactive Value to GGplot breaks HOT 1
- reactives running and trigger observers without open the tab
- Shiny is not releasing memory HOT 2
- Can't Open Chrome Driver in shinyapps.io
- Load plot upon launching Shiny app HOT 1
- shiny.autoreload does not work when runApp is given shinyApp result or a list HOT 1
- selectInput not working anymore within renderDataTable in 1.8.0 HOT 2
- Update jQuery version to 3.7.1
- 'make' not found HOT 3
- Use req() in checkFunction ReactivePoll HOT 5
- v1.8.0: Unable to highlight multiple selected values at once in selectInput/selectizeInput HOT 1
- How to use `Shiny.bindAll` for a DT table? HOT 8
- Why updateDateInput() nor dateRangeInput() don't have the datesdisabled parameter enabled? HOT 1
- Error in init.ts when using library(jsTreeR) HOT 3
- Shiny server not supporting http range requests. This disables seekbars for locally (www folder) hosted media files. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shiny.