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:
@@ -69,8 +69,9 @@ export const TabBar = ({ openFiles, activeFile, onTabClick, onTabClose, onCloseO
|
|||||||
handleCloseContextMenu()
|
handleCloseContextMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isHomeTab = contextMenu.file?.path === HOME_TAB_ID
|
||||||
const contextMenuItems = [
|
const contextMenuItems = [
|
||||||
{ label: '在新窗口中打开', onClick: handlePopOut },
|
...(!isHomeTab ? [{ label: '在新窗口中打开', onClick: handlePopOut }] : []),
|
||||||
{ label: '关闭其他标签页', onClick: handleCloseOther },
|
{ label: '关闭其他标签页', onClick: handleCloseOther },
|
||||||
{ label: '关闭所有标签页', onClick: handleCloseAll }
|
{ label: '关闭所有标签页', onClick: handleCloseAll }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ export function usePopOutTab() {
|
|||||||
content: content || '',
|
content: content || '',
|
||||||
unsavedContent: unsavedContent || content || '',
|
unsavedContent: unsavedContent || content || '',
|
||||||
isEditing: isEditing || false,
|
isEditing: isEditing || false,
|
||||||
loading: loading || false,
|
loading: false,
|
||||||
loaded: loaded !== undefined ? loaded : true,
|
loaded: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
useTabStore.setState((state) => {
|
useTabStore.setState((state) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user