diff --git a/src/hooks/useEditorTabSwap.ts b/src/hooks/useEditorTabSwap.ts index 84b77761..b107604a 100644 --- a/src/hooks/useEditorTabSwap.ts +++ b/src/hooks/useEditorTabSwap.ts @@ -395,12 +395,15 @@ function useTabSwapEffect(options: { if (!rememberPendingTabArrival(activeTabPath, activeTab, pendingTabArrivalPathRef)) { return } + const targetPath = activeTabPath + const readyActiveTab = activeTab + if (!targetPath || !readyActiveTab) return scheduleTabSwap({ editor, cache, - targetPath: activeTabPath, - activeTab: activeTab!, + targetPath, + activeTab: readyActiveTab, pendingSwapRef, prevActivePathRef, rawSwapPendingRef,