Skip to content

Commit

Permalink
fix: fix Proxy issue when using svelte5 and immer together
Browse files Browse the repository at this point in the history
  • Loading branch information
rxliuli committed Dec 6, 2024
1 parent 7a48878 commit dc8ee13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/lib/stores/__tests__/converstation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ it('send message in old conversation', async () => {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
})
await new Promise((resolve) => setTimeout(resolve, 10))
await convStore.create('chat-2', 'gpt-4o', {
id: '3',
content: 'Request',
Expand All @@ -202,6 +203,7 @@ it('send message in old conversation', async () => {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
})
await new Promise((resolve) => setTimeout(resolve, 10))
expect(get(sidebars).map((it) => it.id)).toEqual(['chat-2', 'chat-1'])
// send message in old conversation
await convStore.addMessage('chat-1', {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stores/converstation.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const convStore = {
if (!conversation) {
return
}
conversation.messages.push(message)
conversation.messages.push($state.snapshot(message))
conversation.updatedAt = new Date().toISOString()
}),
)
Expand Down

0 comments on commit dc8ee13

Please sign in to comment.