Skip to content

Restore tab order from last session - #5322

Open
GogoVega wants to merge 4 commits into
node-red:devfrom
GogoVega:restore-tab-order
Open

GogoVega wants to merge 4 commits into
node-red:devfrom
GogoVega:restore-tab-order

Conversation

@GogoVega

Copy link
Copy Markdown
Contributor

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Ref: https://discourse.nodered.org/t/editor-save-tabs-display-and-order-between-web-page-loads/99486

Restore tab order from last session. This also includes subflows, they will be opened and ordered.

The local storage name is tabOrder and it's an array.

Notes:

  • There is no filter mechanism every time the editor is loaded because the reorder overwrites the array.
  • The order of the last session will not be applied if a current tab is not there; to avoid a session that is too old.

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run npm run test to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

@GogoVega

Copy link
Copy Markdown
Contributor Author

I have one reluctance: if a tab is ordered and the editor is reloaded without deployment, the restored tab will not be correctly ordered because it does not respect the flows file order.

@knolleary

Copy link
Copy Markdown
Member

The tab order is determined by the flow file. We shouldn't be reordering regular flow tabs based on undeployed state.

The scope of this should be limited to ensuring any subflows that were previously open are reopened in the expected order.

@AllanOricil

AllanOricil commented Oct 29, 2025 •

Copy link
Copy Markdown
Contributor

I thought that it was to keep any changes done to the tabs in the editor regardless of the deployed state, so that when the User reopens the app his ongoing work is restored. This helps reducing cognitive load because I don't need to reorganize my workspace again before restarting the work where I left

@knolleary

Copy link
Copy Markdown
Member

From the linked forum post that raised the requirement:

It's quite inconvenient to lose all open subflow tabs but the currently active one on web page reload.

That's the core requirement here.

@AllanOricil

Copy link
Copy Markdown
Contributor

From the linked forum post that raised the requirement:

It's quite inconvenient to lose all open subflow tabs but the currently active one on web page reload.

That's the core requirement here.

Ok, it makes sense. But I think that what the User really meant is what @GogoVega is doing in this PR. The guy of the request even gave a ❤️ to the PR, which I interpreted as Acknowledgment of what it was done.

@AllanOricil

Copy link
Copy Markdown
Contributor

Can the requeriment be clarified with the User before throwing away the work?

@knolleary

Copy link
Copy Markdown
Member

If the user reorders their tabs and reloads the editor, they will be prompted to deploy before losing unsaved changes. They have to make a choice to abandon their changes. If they wanted to keep the tab order, they can hit deploy.

What they cannot do is restore all of the open subflows automatically for themselves. That is the scope we should be addressing.

We will address the subflow part. I do not want the editor restoring partial unsaved state.

@AllanOricil

AllanOricil commented Oct 29, 2025 •

Copy link
Copy Markdown
Contributor

I do not want the editor restoring partial unsaved state.

What is the problem you see if the unsaved tab order was restored after, maybe, an unexpected grid outage that did not let the User hit deploy?

Wouldn't it be beneficial to Users if they didn't lose their hard work in such aforementioned scenarios?

Maybe we can reach an agreement to show a message upon opening the editor such as

"You have undeployed changes. Would you like to restore these changes?"

  • If the User hits "No", the unsaved state is dropped
  • if the User hits "Yes", the unsaved state is applied in the client only. The User can choose to Deploy thrse changes or not. If he applies it, but doesn't deploy it, the server state will be loaded the next time the editor reopens, since there is no longer unsaved client state.

@GogoVega

Copy link
Copy Markdown
Contributor Author

We can combine the two functionalities; we just need to make sure that the order matches that of the flow file.

@knolleary knolleary added this to the 5.0 milestone May 5, 2026
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.

3 participants