Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Second fix for back button #746

wants to merge 2 commits into from

Conversation

d-nieto246
Copy link
Collaborator

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.

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.
Copy link
Contributor

@curran curran left a 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}).

openTab,
isInitialized,
]);
decodedTabList.forEach(openTab);
Copy link
Contributor

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.
Copy link
Contributor

@curran curran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run this branch, I see the following error:

image

Do you not see that when you run the code?

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { setTabListReducer } from './setTabListReducer'; // Imported a new reducer
import { setTabListReducer } from './setTabListReducer';

return {
setActiveFileId,
setActiveFileLeft,
Copy link
Contributor

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.

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants