Skip to content

Commit c95b8eb

Browse files
committed
fix: re-check tab fallback after deferred error scans
Paste registers widgets in reactive stores before node:added fires, so the Vue flush that recomputes the panel tabs can run before the deferred missing-model scan registers the pasted node's error. The fallback watchEffect then saw no relevant errors for the selection and flipped the panel off the Errors tab permanently. Re-check one microtask later so in-flight scans can keep the active tab.
1 parent b7ca00a commit c95b8eb

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

src/components/rightSidePanel/RightSidePanel.vue

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,23 @@ const tabs = computed<RightSidePanelTabList>(() => {
223223
return list
224224
})
225225
226-
// Use global state for activeTab and ensure it's valid
226+
function isActiveTabAvailable() {
227+
return (
228+
tabs.value.some((tab) => tab.value === activeTab.value) ||
229+
(activeTab.value === 'subgraph' && isSingleSubgraphNode.value)
230+
)
231+
}
232+
233+
// Use global state for activeTab and ensure it's valid. Deferred scans
234+
// (e.g. pasted-node missing-model detection) can restore the active tab
235+
// within the same tick, so re-check before falling back.
227236
watchEffect(() => {
228-
if (
229-
!tabs.value.some((tab) => tab.value === activeTab.value) &&
230-
!(activeTab.value === 'subgraph' && isSingleSubgraphNode.value)
231-
) {
232-
rightSidePanelStore.openPanel(tabs.value[0].value)
233-
}
237+
if (isActiveTabAvailable()) return
238+
queueMicrotask(() => {
239+
if (!isActiveTabAvailable()) {
240+
rightSidePanelStore.openPanel(tabs.value[0].value)
241+
}
242+
})
234243
})
235244
236245
function resolveTitle() {

0 commit comments

Comments
 (0)