From 179b9881482e1af1763418a4e5159e2972ec6191 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 8 Jul 2025 06:35:33 +1000 Subject: [PATCH] fix(ui): prompt concat derived state recall --- .../web/src/features/metadata/parsing.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/invokeai/frontend/web/src/features/metadata/parsing.tsx b/invokeai/frontend/web/src/features/metadata/parsing.tsx index cad28a8bb9..bd8e04f77d 100644 --- a/invokeai/frontend/web/src/features/metadata/parsing.tsx +++ b/invokeai/frontend/web/src/features/metadata/parsing.tsx @@ -950,21 +950,24 @@ const recallByHandlers = async (arg: { } } - // If we recalled style prompts, and they were _different_ from the positive prompt, we need to disable prompt concat. + // We may need to update the prompt concat flag based on the recalled prompts const positivePrompt = recalled.get(MetadataHandlers.PositivePrompt); const negativePrompt = recalled.get(MetadataHandlers.NegativePrompt); const positiveStylePrompt = recalled.get(MetadataHandlers.PositiveStylePrompt); const negativeStylePrompt = recalled.get(MetadataHandlers.NegativeStylePrompt); + // The values will be undefined if the handler was not recalled if ( - (positiveStylePrompt && positiveStylePrompt !== positivePrompt) || - (negativeStylePrompt && negativeStylePrompt !== negativePrompt) + positivePrompt !== undefined || + negativePrompt !== undefined || + positiveStylePrompt !== undefined || + negativeStylePrompt !== undefined ) { - // If we set the negative style prompt or positive style prompt, we should disable prompt concat - store.dispatch(shouldConcatPromptsChanged(false)); - } else { - // Otherwise, we should enable prompt concat - store.dispatch(shouldConcatPromptsChanged(true)); + const concat = + (Boolean(positiveStylePrompt) && positiveStylePrompt === positivePrompt) || + (Boolean(negativeStylePrompt) && negativeStylePrompt === negativePrompt); + + store.dispatch(shouldConcatPromptsChanged(concat)); } if (!silent) {