Skip to content

Selectize options are overwritten or silently dropped #2052

@elnelson575

Description

@elnelson575

During our investigation of #1703 we discovered that there are a subset of issues arising from how and in what order we set options in update_selectize.

For example, in this example, the user-provided options are dropped silently:

from shiny import reactive
from shiny.express import ui

ui.input_selectize(
    "foo",
    "Foo",
    choices=[],
    multiple=True,
)


@reactive.effect
def _():
    ui.update_selectize(
        "foo",
        choices=[f"Foo & {i}" for i in range(1000)],
        options={"placeholder": "Select an option"},
    )

Two permutations that need investigation are:
update_selectize(..., server=True, options = {"placeholder": "Select an option"})
and
update_selectize(..., options = {"placeholder": "Select an option"})

UPDATE:
Based on the difference in behavior between server and client, it seems like this is an us issue.

We need to decide what the behavior should be when you specify options in update_selectize.
Should this add additional options to some default list?
Replace the list entirely?
We should investigate what the current behavior is in R Shiny. This should be consistent
We were looking at selectInput.ts 289 and how that differs from the preceding code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions