Skip to content

fix: code editor tab persistence and close behavior#12270

Open
jakub961241 wants to merge 1 commit into1Panel-dev:dev-v2from
jakub961241:fix/editor-tab-persistence-12098
Open

fix: code editor tab persistence and close behavior#12270
jakub961241 wants to merge 1 commit into1Panel-dev:dev-v2from
jakub961241:fix/editor-tab-persistence-12098

Conversation

@jakub961241
Copy link

Summary

Fixes #12098 - Three bugs in the file management code editor tabs.

Bug 1: Closed tabs reopen next time

removeTab() and removeAllTab() modified fileTabs.value but never called saveTabsToStorage(), so the removal was never persisted to localStorage.

Fix: Added saveTabsToStorage() calls after every tab removal path (save+close, discard+close, direct close).

Bug 2: Last tab can't be closed

:closable was conditioned on fileTabs.length > 1, and the context menu (Close All, etc.) was hidden for single tabs.

Fix: Changed to >= 1 so the close button and context menu are always available.

Bug 3: Missing watch import

watch was used in tabs/index.vue but not imported from Vue, causing tab selection sync issues.

Changed files

  • frontend/src/views/host/file-management/code-editor/index.vue - Persist tab removal to localStorage
  • frontend/src/views/host/file-management/code-editor/tabs/index.vue - Allow closing last tab, fix watch import
fix: Code editor tabs now properly persist when closed, last tab can be closed, and "Close All" is always available (#12098)

Three bugs fixed in the file management code editor:

1. Closing tabs didn't persist - removeTab() and removeAllTab() never
   called saveTabsToStorage(), so closed tabs would reappear on next
   editor open.

2. Last tab couldn't be closed - :closable condition required
   fileTabs.length > 1, preventing closing the last remaining tab.
   Changed to >= 1. Context menu (close all, etc.) also now shows
   for single tabs.

3. Missing watch import in tabs component caused reactivity issues
   with tab selection synchronization.

Fixes 1Panel-dev#12098
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Mar 22, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign wanghe-fit2cloud for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] A minor issue with the text editor

1 participant