Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix: Multiple Stale Maps (streamlit#9092)
## Describe your changes So debugging this took me all over the codebase. 😅 But one thing that kept popping up that was giving me a gut reaction that it might be the culprit was the duplicate key React errors we're seeing in console in `develop`. I tested if making the id's unique fixed the problem, and it did. I then read the comment above this function `/** Return an Element's widget ID if it's a widget, and undefined otherwise. */` So I then changed it to if it is a map, return `undefined`. If that comment is indeed true, should we make this change apply to all non-widgets? (And if so, how does one check if an element is a widget? Is there some helper somewhere for that?) | Before | After | | ------ | ------| |  |  | ## GitHub Issue Link (if applicable) This PR fixes streamlit#8329 ## Testing Plan Manually tested as seen in above screen captures. If the team is aligned with the fix, I'd like to add some automated test coverage for this. # Update Post Discussion The engineering team met to discuss a few options to resolve this bug considering future plans in this area. 1. Renaming the proto field from `id` to `hash` 2. Compute a proper widget id for `st.map` and add a `key` argument to `st.map`. 3. Add element differentiation to the frontend code (if `st.map` then ignore `id`) Given that we will soon be workling on selections in maps, we decided to go with the easiest fix as a short term solution, option 3. We plan to remove this code when we properly fix it. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
- Loading branch information