fix: introduced clientId for lists, to avoid duplicate list after server sync
PR Checks / lint-and-test (pull_request) Successful in 1m28s

This commit is contained in:
2026-09-14 13:30:17 +02:00
parent e0a8377bec
commit 8f3ece17ac
3 changed files with 15 additions and 3 deletions
+8 -2
View File
@@ -147,8 +147,10 @@ export const useListsStore = defineStore('lists', () => {
async function createList(name: string): Promise<LocalList> {
const now = new Date().toISOString()
const id = generateId()
const localList: LocalList = {
id: generateId(),
id,
clientId: id,
name,
created_at: now,
modified_at: now,
@@ -538,7 +540,11 @@ export const useListsStore = defineStore('lists', () => {
for (const serverList of serverLists) {
const existingList = localById.get(serverList.id)
if (!existingList || !existingList.pendingSync) {
toPut.push({ ...serverList, pendingSync: false })
toPut.push({
...serverList,
pendingSync: false,
clientId: existingList?.clientId ?? serverList.id,
})
}
}
if (toPut.length > 0) {