Skip to content

Commit 8f2cf16

Browse files
andresdjassoclaude
andcommitted
fix(workflow): no frame flash or empty stack card during load
The chrome-frame flag now flips in a layout effect, so the content card's border drops in the same paint the floating cards appear — never a frame behind them mid-load. A deep link whose resource id resolves to nothing (not in the strip, not a page id) now collapses the stack immediately inside the restore instead of stranding an empty "add a resource" card — the auto-collapse effect can't catch that case since clearing the pending ref changes none of its deps. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 44f7229 commit 8f2cf16

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/docked-chat/workflow-with-chat.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
3+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
44
import { useParams, useSearchParams } from 'next/navigation'
55
import { Tooltip } from '@/components/emcn'
66
import { Workflow as WorkflowIcon, X } from '@/components/emcn/icons'
@@ -156,14 +156,19 @@ export function WorkflowWithChat() {
156156
openTabs(workspaceId, [{ type: 'page', id, title: MOTHERSHIP_PAGES[id] }], {
157157
focusId: id,
158158
})
159+
return
159160
}
161+
// Nothing stageable behind the link — close immediately rather than
162+
// showing an empty card (the auto-collapse effect won't re-run here,
163+
// since clearing the pending ref changes none of its deps).
164+
collapseStack()
160165
}
161166
if (useMothershipTabsStore.persist.hasHydrated()) {
162167
apply()
163168
return
164169
}
165170
return useMothershipTabsStore.persist.onFinishHydration(apply)
166-
}, [workspaceId, setActiveTab, openTabs])
171+
}, [workspaceId, setActiveTab, openTabs, collapseStack])
167172

168173
/** Escape flips the editor forward (the stack stays one click away). */
169174
useEffect(() => {
@@ -287,8 +292,10 @@ export function WorkflowWithChat() {
287292
const isStackMode = stackOpen && stageFront === 'card'
288293

289294
// The workspace chrome drops its content card frame while modules float.
295+
// Layout effect: the frame must flip in the same paint as the cards, never
296+
// a frame behind them (visible as a flash during load).
290297
const setStageFloating = useSidebarStore((s) => s.setStageFloating)
291-
useEffect(() => {
298+
useLayoutEffect(() => {
292299
setStageFloating(isStackMode)
293300
return () => setStageFloating(false)
294301
}, [isStackMode, setStageFloating])

0 commit comments

Comments
 (0)