-
Notifications
You must be signed in to change notification settings - Fork 644
Feature/reclickable button #672
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
Open
clare-chemery
wants to merge
15
commits into
StructuredLabs:main
Choose a base branch
from
clare-chemery:feature/reclickable-button
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/reclickable button #672
clare-chemery
wants to merge
15
commits into
StructuredLabs:main
from
clare-chemery:feature/reclickable-button
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi @shivam-singhal @amrutha97 - when I was working on my demo app I noted that a reclickable button would be a "nice to have" feature for exploratory data apps. This PR implements the reclickable button and makes state management more explicit between the library and the frontend. Let me know what you think! |
6ac1dad
to
bdb2c4e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
name: Feature/reclickable-button
about: For data exploration, you may want to refresh components that randomly sample data. Therefore the button should be reclickable and downstream components should update.
title: ''
labels: ''
assignees: ''
Description of Changes
The state management for components is currently based on the "value" key in their component definitions in
preswald/interfaces/components.py
. This means that once a button, for example, isTrue
, it can no longer be reclicked. By adding a random state to the button when the reclick functionality is desired, a reclick will trigger a re-rendering of downstream components that have changed.All components that already include the "value" key automatically re-render, but components without this key - e.g.
image()
andplotly()
components - do not. I have added an optional "state_key" to the component dictionaries which can be used to point to the attribute which should control the state of the component on the frontend.Finally, I added my app,
lego-challenge
which showcases the new reclickable button, leading to re-rendering of text, image, and plotly components downstream. Note: This PR also fixes a bug that I noticed with the slider in the tutorial: changing the value of the slider does not update the number of rows shown in the table.Type of Change
Testing
Please describe the tests that you ran to verify your changes. Include screenshots/videos.
Run the
lego-challenge
app and click the"Take a step!"
button multiple times to see the downstream components update.Checklist