Repository navigation
fix(web): remember the document pane's tab across a reload - #122
Merged
Merged
Conversation
The pane kept its tab in component state, so a reload opened the default and the person had to find their place again. The tab the person is on is kept per project in this browser, like the other preferences, and restored once it can be shown; the pane's own jumps to a new draft or concept wait for that, and the person's choice always wins.
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.
Closes #121
What
The document pane remembers the tab the person was on, per project, in this browser, and returns to it after a reload.
Why
The pane kept its tab only in component state, so every reload opened the default (the live app once the build has started, else the document furthest along) and the person had to find their place again. Details in #121.
Changes
apps/web/src/pages/workspace/artifact-pane.tsx: the pane takesprojectIdand keeps the tab undersb.paneTab.<projectId>throughstored-preference.ts, written on the person's choice, on a document the page opens, and on the pane's own jump to a new draft or concept. On a visit,availableTabsays whether the remembered tab can be shown yet; a side tab (live app, manual, themes, draft, concept) is restored once it is there, and a remembered document opens throughresolveSelectionin place of the default. While a remembered tab waits, the pane's jumps to a new draft or concept hold off; the person choosing anything ends the wait. A remembered tab that is not here falls back to the default as before.apps/web/src/pages/workspace/index.tsx: passes the project id.artifact-pane.test.tsxcoversavailableTaband the remembered document inresolveSelection.