fix(ui): clear pending trigger phrase immediately

If we don't clear it, there's an awkward flash of error state as the mutation completes.
This commit is contained in:
psychedelicious 2024-03-07 18:56:44 +11:00
parent fe8e391aad
commit 4077dfe0c3

View File

@ -56,11 +56,12 @@ export const TriggerPhrases = () => {
return; return;
} }
setPhrase('');
await updateModel({ await updateModel({
key: selectedModelKey, key: selectedModelKey,
body: { trigger_phrases: [...triggerPhrases, phrase] }, body: { trigger_phrases: [...triggerPhrases, phrase] },
}).unwrap(); }).unwrap();
setPhrase('');
}, [updateModel, selectedModelKey, phrase, triggerPhrases]); }, [updateModel, selectedModelKey, phrase, triggerPhrases]);
const removeTriggerPhrase = useCallback( const removeTriggerPhrase = useCallback(