fix(webui): keep automation change-back state accurate
This commit is contained in:
1 parent
b032a24960
commit
17a66dcecf
2 files changed
+42
-2
No files matched your search
@@ -56,7 +56,10 @@ export function AutomationChatBinding({ job, token, chatNames, onSave, children
|
||||
const controller = new AbortController();
|
||||
setLoadError(false);
|
||||
void fetchAutomationChats(token, job.id, controller.signal).then(value => {
|
||||
if (!controller.signal.aborted) setData(value);
|
||||
if (!controller.signal.aborted) {
|
||||
setData(value);
|
||||
setSaved(previous => previous?.target.id === value.current?.id ? previous : null);
|
||||
}
|
||||
}).catch(() => { if (!controller.signal.aborted) setLoadError(true); });
|
||||
return () => controller.abort();
|
||||
}, [token, job.id, job.chat_binding_revision, reload]);
|
||||
@@ -91,7 +94,7 @@ export function AutomationChatBinding({ job, token, chatNames, onSave, children
|
||||
disabled={pickerDisabled} onValueChange={id => {
|
||||
const target = data?.chats.find(chat => chat.id === id);
|
||||
if (!target || target.unavailable || id === current?.id) return;
|
||||
setError(""); setSaved(null);
|
||||
setError("");
|
||||
setDraft(previous => previous ? { ...previous, target } : {
|
||||
target, previous: current ?? fallback,
|
||||
revision: job.chat_binding_revision!, message: job.payload.message,
|
||||
|
||||
Reference in new issue
Block a user