Choosing a selectize value that's not initially loaded (because of maxOptions)
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 123
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
Below I'm trying to manipulate a server-side selectize field using shinytest2.
When the to-be-selected value is among the initially loaded choices, this works fine.
But when it's not (because of the maxOptions cap), it doesn't.
Is there a way to make it work?
Thanks!
Toy app:
library(shiny) # v1.7.1
ui <- fluidPage(
selectizeInput(
'select', 'Select',
choices = NULL,
options = list(maxOptions = 5)
)
)
server <- function(input, output, session) {
updateSelectizeInput(
inputId = 'select',
choices = 1:10, server = TRUE
)
}
shinyApp(ui = ui, server = server)
Test:
library(shinytest2) #v0.1.0
app <- AppDriver$new(name = "test")
# works, prints "5"
app$set_inputs(select = 5)
print(app$get_values()$input$select)
app$view()
# doesn't work, prints ""
app$set_inputs(select = 6)
print(app$get_values()$input$select)
app$stop()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the toy app with selectizeInput, updateSelectizeInput, and the AppDriver set_inputs/get_values calls, comparing values 5 and 6. Trace how server-side choices interact with the maxOptions setting and verify that selecting a value outside the initial choices is returned as input$select.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100