fix: prevent state loss when popout tab and hide option for home tab

- Force loaded:true and loading:false in usePopOutTab to prevent auto-load overwriting
- Hide '在新窗口中打开' option for home tab in context menu
This commit is contained in:
2026-03-22 00:00:34 +08:00
parent aa5895873b
commit d0e286e4bb
2 changed files with 4 additions and 3 deletions

View File

@@ -69,8 +69,9 @@ export const TabBar = ({ openFiles, activeFile, onTabClick, onTabClose, onCloseO
handleCloseContextMenu()
}
const isHomeTab = contextMenu.file?.path === HOME_TAB_ID
const contextMenuItems = [
{ label: '在新窗口中打开', onClick: handlePopOut },
...(!isHomeTab ? [{ label: '在新窗口中打开', onClick: handlePopOut }] : []),
{ label: '关闭其他标签页', onClick: handleCloseOther },
{ label: '关闭所有标签页', onClick: handleCloseAll }
]

View File

@@ -35,8 +35,8 @@ export function usePopOutTab() {
content: content || '',
unsavedContent: unsavedContent || content || '',
isEditing: isEditing || false,
loading: loading || false,
loaded: loaded !== undefined ? loaded : true,
loading: false,
loaded: true,
}
useTabStore.setState((state) => {