Skip to content

ui.input_task_button doesn't work inside module #1107

@pstorozenko

Description

@pstorozenko

It seems to me that the freshly introduced input_task_button doesn't work with shiny modules.

The following code:

from shiny import App, module, reactive, render, ui


@module.ui
def button_ui():
    return ui.p(
        # ui.input_task_button("btn", label="Click me!"),
        ui.input_action_button("btn", label="Click me!"),
        ui.output_text("text_counter"),
    )


@module.server
def button_server(input, output, session):
    counter = reactive.Value(0)
    @render.text
    def text_counter():
        return f"Button clicked {counter()} times"
    
    @reactive.effect
    @reactive.event(input.btn)
    def increment_counter():
        counter.set(counter() + 1)


app_ui = ui.page_fluid(
    button_ui("button")
)


def server(input, output, session):
    button_server("button")


app = App(app_ui, server)

Work with ui.input_action_button it works, but with ui.input_task_button I get the following message in the terminal:

INFO:     connection open
_send_error_response: The string 'button-btn' is not a valid id; only letters, numbers, and underscore are permitted
INFO:     connection closed

Am I write, or the input_task_button should be used in a different way?


shiny == 0.7.0, python == 3.10.13

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