|
|
|
@ -683,11 +683,6 @@ function ComposerEditor({ |
|
|
|
const syncNodeReferenceSubjectList = useWorkflowStore((state) => state.syncNodeReferenceSubjectList); |
|
|
|
const reorderNodeReferenceSubjectList = useWorkflowStore((state) => state.reorderNodeReferenceSubjectList); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
setConfig(initialDraft); |
|
|
|
setPrompt(initialDraft.prompt); |
|
|
|
}, [contextKey]); |
|
|
|
|
|
|
|
const persistCurrentComposerConfig = useCallback(() => { |
|
|
|
onPersistConfig(context, { ...config, prompt }); |
|
|
|
}, [config, context, onPersistConfig, prompt]); |
|
|
|
@ -953,11 +948,14 @@ function ComposerEditor({ |
|
|
|
}, []); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (!isHidden) return; |
|
|
|
persistCurrentComposerConfig(); |
|
|
|
if (isHidden) { |
|
|
|
stopReferenceAudioPreview(); |
|
|
|
onHiddenPersisted?.(); |
|
|
|
// Hidden state is the only trigger for the save-before-unmount flow.
|
|
|
|
return; |
|
|
|
} |
|
|
|
setConfig(initialDraft); |
|
|
|
setPrompt(initialDraft.prompt); |
|
|
|
// Hidden composer state is discarded; reopening hydrates from the store.
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, [isHidden]); |
|
|
|
|
|
|
|
|