Skip to content
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

Make input_selectize work correctly within a module #1091

Merged
merged 6 commits into from
Feb 2, 2024

Conversation

jcheng5
Copy link
Collaborator

@jcheng5 jcheng5 commented Jan 31, 2024

TODO

  • Automated test

Description

User adam_pinky reported this on Discord:

Hi team, we found a regression upgrading to shiny v0.7.0. The really useful input selectize multiple choice ui element no longer renders correctly. It shows only as a list. Interestingly, this behaviour only appears to occur when using shiny modules.

Could the team confirm whether there is any workaround or if we are using the modules incorrectly for v0.7.0?

Repro
import shiny


@shiny.module.ui
def module_ui() -> shiny.types.NavSetArg:
    """Build module 1 UI"""
    return shiny.ui.nav_panel(
        "module1",
        shiny.ui.input_selectize(
            "id",
            "labels",
            [1, 2, 3, 4],
            multiple=True,
        ),
    )


@shiny.module.server
def module_server(app_input: shiny.Inputs, output: shiny.Outputs, _) -> None:
    """Build Module 1 Server"""


def server(_, __, ___):
    """Shiny main server"""
    module_server("module1")


UI = shiny.ui.page_navbar(
    module_ui("module1"),
)

app = shiny.App(UI, server)

https://shinylive.io/py/editor/#code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMASxlWICcyACAZwAsaJsAdCfvwACnbtgwxiAEwCuAGzgYZNflLgAzFpNkKA+soAUAShYBaAHzsuPDGWyo4bDADkoANwDKcMgEFGAc0R+FhCWXjBw8IAhZTkpLWl5OBYARhYAVQBJSIiIiFCWRm8ZRnzRG2UMaDddVCgIODkDYILQ8O0klPC8FtarMSUaDG5UGTJdNka4QjIaAC84Zvy+1vCaKW7elZDwuSgAI0a2TeXtkOAUvBYAJiuAZiuAFgBdHtOzmHlZ1AUAXgAVRgyOBvbZGUGhIyCAQQETWcQdBQYSaMNxwRiqDQJHRwCbotGMAxoVC6EZjRD9GyZCCjMhsK7EMa0inlcQAeSZY3pLF0JgsLGcpDgQXeOWisXiAFlEgpUiwvKj0WK8tC1JoUQSDLorrptTzdUYRQVlR54VooNx2PilblIu9EbiNejmmAHV0wFCYfwsixfpTxJU6v5cdV9lBCVsHfoaC63eFwfxPfxib7-RgfOgDFkrk7GJ6wABfZ5AA

@adampinky85
Copy link

adampinky85 commented Jan 31, 2024

thanks @jcheng5 much appreciated!

CHANGELOG.md Outdated Show resolved Hide resolved
state.set("IA")

state.expect_selected("IA")
# TODO: This test was being run against input_select, not input_selectize
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels off to me. I'd like double check this in the morning before we merge the PR.

Everything else is great!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. To my knowledge, selectize.js changed how it stores options / selected values.

Either way, if we would have used the correct selectize testing class, the error would have been surfaced earlier.

Yes, we should do this in a followup PR as the changes are not related to this Issue

Co-authored-by: Barret Schloerke <barret@posit.co>
@schloerke schloerke merged commit 337955d into main Feb 2, 2024
26 checks passed
@schloerke schloerke deleted the bugfix-selectize-module branch February 2, 2024 15:21
schloerke added a commit that referenced this pull request Feb 13, 2024
* main:
  Bump version to 0.7.1.9000
  Fix input_task_button for modules (#1108)
  Bump version to 0.7.1
  Test input task button and extended task decorator (#1099)
  Add remaining examples for express API reference (#1093)
  test: Add `make playwright-debug` to help debug playwright tests (#1097)
  Make input_selectize work correctly within a module (#1091)
  Update types to allow `navset_*` functions to accept `MetadataNode` args (#1094)
  Update changelog
  Update express.ui.hold() to accept any type of object (#1089)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants