diff --git a/src/workspaces/officerdev/src/channels.ts b/src/workspaces/officerdev/src/channels.ts index a5fab7d9..f238345c 100644 --- a/src/workspaces/officerdev/src/channels.ts +++ b/src/workspaces/officerdev/src/channels.ts @@ -97,3 +97,20 @@ export const useBackgroundJobChanged = () => { const bump = useCallback(() => setRef.current(++nonce), []); return [signal, bump] as const; }; + +/** + * "A generation finished — anyone showing the gallery should re-read." + * + * The Generate and Gallery panels are independent siblings (see `plugins/atelier/web/panels.ts`) with + * no props between them, so a finished job reaching the gallery needs a signal rather than a callback + * prop the way the standalone app's `onFinished` was. Same stable-bump shape as `useFilesRefresh`. + */ +const useAtelierRefreshChannel = defineChannel('atelier:refresh-signal', 0); + +export const useAtelierRefresh = () => { + const [signal, setSignal] = useAtelierRefreshChannel(); + const setRef = useRef(setSignal); + setRef.current = setSignal; + const bump = useCallback(() => setRef.current(++nonce), []); + return [signal, bump] as const; +};