fix(studio): use session storage as default cache for tab state #39175
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.
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Because local storage is used to store editor tab state, working across multiple browser tabs can lead to confusing behavior of loading tab state from the previously used tab when clicking around the UI.
What is the new behavior?
Now tab state is saved to both session storage (scoped to the individual browser tab) as well as local storage and then when reading defaults to session storage. For a new tab that doesn't have anything stored in it's session it will read from local storage which will reflect the most recent tab state.
Additional context
To test: open table editor in multiple browser tabs of the same browser and ensure that when clicking between tabs or other table links that the state is consistent to the individual tab and doesn't affect other tabs.