Skip to content

Commit d4f6d09

Browse files
fix(ui): never subscribe to dynamic prompts queries
If the request errors, we would never get to unsubscribe. The request would forever be marked as having a subscriber and never be cleared from memory.
1 parent 44e4460 commit d4f6d09

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

invokeai/frontend/web/src/features/dynamicPrompts/hooks/useDynamicPromptsWatcher.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ export const useDynamicPromptsWatcher = () => {
3333
// Try to fetch the dynamic prompts and store in state
3434
try {
3535
const req = dispatch(
36-
utilitiesApi.endpoints.dynamicPrompts.initiate({
37-
prompt: positivePrompt,
38-
max_prompts: maxPrompts,
39-
})
36+
utilitiesApi.endpoints.dynamicPrompts.initiate(
37+
{
38+
prompt: positivePrompt,
39+
max_prompts: maxPrompts,
40+
},
41+
{ subscribe: false }
42+
)
4043
);
4144

4245
const res = await req.unwrap();
43-
req.unsubscribe();
4446

4547
dispatch(promptsChanged(res.prompts));
4648
dispatch(parsingErrorChanged(res.error));

0 commit comments

Comments
 (0)