fix(client): flow occupancy is a subscribed source; an unloading occupant withdraws the open flow

hasDirectoryFlow was a plain per-render read: a flow plugin unloading (HMR)
while its dialog was open left flowOpen stuck with nobody to cancel,
permanently disabling the workspace actions. Occupancy now rides
useSyncExternalStore over the hole's registration subscription, and an
empty hole withdraws an active flow; the menu entry also reacts to
activation without a reopen (ds-review-bot).
This commit is contained in:
creatixchu
2026-07-29 02:36:08 +08:00
parent 3f23347d10
commit 7114cc7475
7 changed files with 77 additions and 22 deletions
@@ -60,6 +60,7 @@ function mount(overrides: Partial<WorkspaceBrowserProps> = {}) {
insertSessionBefore: vi.fn(async () => {}),
createWorkspace: vi.fn(async () => workspace('created', [])),
hasDirectoryFlow: () => true,
subscribeDirectoryFlow: () => () => {},
renderSlot: ((_name: string, owner: { open: boolean }) => (owner.open ? <div data-testid="directory-flow" /> : null)) as never,
...overrides,
}