From 9a4e79e4efd11b924b9caff698ae643dfab0e8a2 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 26 Apr 2026 17:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(im):=20conversation.messages?= =?UTF-8?q?=20=E5=85=A5=20IDB=20=E5=89=8D=E7=94=A8=20toRaw=20=E8=A7=A3=20P?= =?UTF-8?q?roxy=EF=BC=8C=E5=90=A6=E5=88=99=20structuredClone=20=E6=8A=9B?= =?UTF-8?q?=20DataCloneError=20=E9=9D=99=E9=BB=98=E4=B8=A2=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/im/home/store/conversationStore.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/views/im/home/store/conversationStore.ts b/src/views/im/home/store/conversationStore.ts index 301a092d9..73d1b162c 100644 --- a/src/views/im/home/store/conversationStore.ts +++ b/src/views/im/home/store/conversationStore.ts @@ -1,4 +1,5 @@ import { defineStore } from 'pinia' +import { toRaw } from 'vue' import { store } from '@/store' import { CACHE_KEY, useCache } from '@/hooks/web/useCache' @@ -168,10 +169,12 @@ export const useConversationStore = defineStore('imConversationStore', { Array.isArray(target) ? target : target ? [target] : [] ).filter((c) => !c.deleted) for (const conversation of conversationsToFlush) { + // toRaw 拆掉 Vue reactive Proxy:IDB 的 structuredClone 不接受 Proxy, + // 不拆会抛 DataCloneError 静默落盘失败(只 meta 写得进去,messages 永远丢) tasks.push( imStorage.setItem( StorageKeys.conversationMessage(userId, conversation.type, conversation.targetId), - conversation.messages + toRaw(conversation.messages) ) ) }