-
Notifications
You must be signed in to change notification settings - Fork 14
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
Second fix for back button #746
base: main
Are you sure you want to change the base?
Conversation
The same pull request as #740 but in a new branch called "new-fix-back-button" so everything merged into main works along with my changes.
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.
Almost there! I noticed that it loses the "transient tabs" feature, which is where the tab opens and is italic. After these changes, when you open a tab, it is not transient.
We also need to close the tabs that are removed from the URL.
Instead of this
decodedTabList.forEach(openTab);
I wonder if we could do something more straightforward like this:
setTabList(decodedTabList)
There is currently no such thing as setTabList
, but you could define it in useActions
.
You could even go one step further and define something in useActions
that will update the tab list AND the active file in a single state update, which might be the cleanest solution. Maybe something like setTabListAndActiveFileId({tabList, activeFileId})
.
src/client/useURLSync.ts
Outdated
openTab, | ||
isInitialized, | ||
]); | ||
decodedTabList.forEach(openTab); |
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.
We also need to close the tabs that were closed.
The third fix for the back button.
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.
@@ -12,6 +12,7 @@ import { setIsDocOpenReducer } from './setIsDocOpenReducer'; | |||
import { setThemeReducer } from './setThemeReducer'; | |||
import { editorNoLongerWantsFocusReducer } from './editorNoLongerWantsFocusReducer'; | |||
import { setUsernameReducer } from './setUsernameReducer'; | |||
import { setTabListReducer } from './setTabListReducer'; // Imported a new reducer |
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.
import { setTabListReducer } from './setTabListReducer'; // Imported a new reducer | |
import { setTabListReducer } from './setTabListReducer'; |
return { | ||
setActiveFileId, | ||
setActiveFileLeft, |
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.
These are used in the keyboard shortcuts. Deleting them will break things.
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.
Before deleting things, it's a good idea to search for them in the codebase to see if they are used anywhere.
The same pull request as #740 but in a new branch called "new-fix-back-button" so everything merged into main works along with my changes.