fix(chat): keep attachment upload status reactive

main
jacentsao 2026-08-03 12:48:31 +08:00 committed by lyingbug
parent fe65633f38
commit cbac06564d
1 changed files with 5 additions and 1 deletions

View File

@ -124,9 +124,13 @@ const addFiles = async (files: File[]) => {
};
attachments.value.push(attachment);
// Vue wraps objects inserted into a ref-backed array with a reactive proxy.
// Keep using that proxy in async upload/poll callbacks; mutating the raw
// object above does not trigger the attachment status UI to re-render.
const reactiveAttachment = attachments.value[attachments.value.length - 1];
emit('update:files', [...attachments.value]);
if (props.sessionId) {
void uploadAttachment(attachment);
void uploadAttachment(reactiveAttachment);
}
}
};