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 user_key and wid conflation bugs, rename arguments for clarity #3827
Conversation
Something I considered but didn't immediately decide to do is renaming the generic It is also worth considering totally excising the |
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.
I haven't figured out exactly what's going on here yet, but this currently (surprisingly to me) introduces a regression to behavior similar to that described in #3534. The difference now is that it's every other click that gets reset unexpectedly
I think the script in #3534 is inherently going to have that kind of issue with the transient widget model, because it sets one of the widget function's arguments to a changing value, which has the effect of making the code setting the "default" also reset the widget frequently, which will cause changes from the web app to be dropped (because they're for a no longer used widget).
This is a modified version of the code using session state to only set the value if it doesn't exist. I don't know why it would have been working before this PR, because it seems to me that it shouldn't have been. |
Actually I just tried the original script from 3534 and it has the same behavior on both develop and this branch |
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.
It turns out the revival of #3534 currently exists on develop
, so that isn't a blocker to get this PR in, and we can figure out what to do about #3534 regressing in a followup change
(edit: the behavior being revived here actually existed pre-session_state, so its revival is essentially a consequence of us choosing to revert widget identity semantics to what they were in the pre-state world)
* develop: mypy: ignore git package entirely Update submodule reference for component-template (streamlit#3831) Update component-lib version Update change log Update change log Update changelog with docs link Add advanced widget docs page (streamlit#3820) Updates Components API with theme.base support (streamlit#3826) Adds memo and singleton docstrings to API reference (streamlit#3825) Add advanced widget docs page (streamlit#3820) Fix user_key and wid conflation bugs (streamlit#3827) Fix user_key and wid conflation bugs (streamlit#3827) (Hopefully) Fix CI, and also suppress some warnings (streamlit#3828) Bugfix/3580 (streamlit#3808) Up version to 0.89.0 Update change log
A chunk of the session state api had ambiguous argument names, from back when we were trying to make user keys and widget ids interchangeable rather than being clear and explicit. Renaming them revealed an issue with the checks in
__setitem__
, which is now fixed, and the prompting issue of not checking the right key for setting the frontend value is also fixed by adding auser_key
argument.I don't know how these two bugs were in there, because I thought we had tests for these cases, but maybe we do and those tests are just too narrow.