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

Fix input_task_button for modules #1108

Merged
merged 6 commits into from
Feb 5, 2024
Merged

Fix input_task_button for modules #1108

merged 6 commits into from
Feb 5, 2024

Conversation

jcheng5
Copy link
Collaborator

@jcheng5 jcheng5 commented Feb 5, 2024

Fixes #1107

The task button installs an input handler, which it uses to implement its auto-reset feature. One of the arguments to the input handler is the name/id of the input, a string. When a task button is in a module, that id string contains the module/namespace name as well.

Module-aware code in Shiny assumes regular strings are un-namespaced id's (akin to a relative path), and ResolvedId objects as namespaced id's (akin to an absolute path). In this case, we had a string that contained a namespaced id. That's then passed to update_task_button, which complains that it contains characters that shouldn't be part of an id.

This PR fixes the problem by changing the input_handler invoking code, changing the string id to a ResolvedId as early as possible.

datetime.strptime(v, "%Y-%m-%d").date() for v in value
return (
datetime.strptime(value[0], "%Y-%m-%d").date(),
datetime.strptime(value[1], "%Y-%m-%d").date(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This slight rewrite means we don't need to use pyright pragmas. Same below.

@jcheng5 jcheng5 marked this pull request as ready for review February 5, 2024 19:02
@jcheng5 jcheng5 merged commit b28a962 into main Feb 5, 2024
12 of 24 checks passed
@jcheng5 jcheng5 deleted the task-button-modules branch February 5, 2024 19:17
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.

ui.input_task_button doesn't work inside module
2 participants