-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor slider state management #322
Refactor slider state management #322
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three (or even four) states maintained in the same moment is are not needed.
selected_state
is actual selection from any (slider and numeric inputs)- changes in slider update numeric_state
- changes in numeric update slider_state
Given above, each state needs to have same values which can be simplified by the single state shared by slider, numeric and also returned to "keep_slider_updated".
Thank you @gogonzo I was able to remove an unwanted reactiveVal Here are my comments related to the state variables:
I think some comments can help here. I'll try to come up with better naming to make it easier to understand. |
All above can be simplified to:
I think change counter is not even needed because technically
I'm pretty sure that selected_state and slider_state in the same time are not needed. I think a single
|
Thank you, let me try to implement this. |
…a reactivity issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful. Issue fixed, test covered, -300 lines net in the R/
directory 💪
Wooop wooop wooop!!! |
Closes #321
Changes:
toggle_slider_ui
andtoggle_slider_server
can only be used to create dichotomous slider now. There was no instance of single value slider created. So, there is no need to create it and increase the complexity.keep_range_slider_updated
in favor ofkeep_slider_state_updated
to keep the states updated based on other widget inputs.tm_g_gh_lineplot
does not use thekeep_slider_state_updated
and directly updates the state reactiveValues.Check all the modules that use the
toggle_slider
module:tm_g_gh_boxplot
tm_g_gh_correlationplot
tm_g_gh_density_distribution_plot
tm_g_gh_lineplot
tm_g_gh_spaghettiplot
tm_g_gh_scatterplot
(deprecate in favor oftm_g_gh_correlationplot
)