Reset component state when switching sites - #1247
Merged
Merged
Conversation
epeicher
approved these changes
Apr 23, 2025
epeicher
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the changes! They make sense to me and after some general testing, I have not found any issues. LGTM! ![]()
CleanShot.2025-04-23.at.11.33.38.mp4
katinthehatsite
approved these changes
Apr 23, 2025
katinthehatsite
left a comment
Contributor
There was a problem hiding this comment.
Nice, thanks for the fix!
I (of course 🤦 ) was testing something else in the meantime so I removed the expired sites on my end so I can not test with the original issue. But from what I saw earlier, the changes make sense to me.
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
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.
Related issues
Proposed Changes
In #775, we worked on an issue caused by React state not resetting when selecting another site in Studio. This happens because the
keyprop passed toTabPanelreferences only the active tab and not the selected site.@katinthehatsite raised another issue in #1242 (comment) that I suspect is related to the same thing.
This PR fixes the problem by including the selected site ID in the
keyprop passed toTabPanel.See the React docs for more details on resetting state with a
keyprop.Testing Instructions
Ideally, @katinthehatsite would retry the same steps as in #1242 (comment) and ensure that it works as expected now.
For other testers, do a light smoke test of the Sync tab, the Previews tab, the Import/Export tab, and the Settings tab. While this should be a low-risk change, it also has far-reaching effects on state handling.
Pre-merge Checklist