From e54987555222bfd92c6c1d805ce06a185206af90 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Wed, 4 Nov 2026 21:31:08 +0100 Subject: [PATCH] fix(store): guard findIndex(-1) in the data store actions updateColumn and updatePublicRow assigned to columns[stateId][-1] and rows[stateId][-1] when the updated node was not in the local store. That creates a bogus "-1" property the getters never iterate over, so a successful server call left the store silently out of sync instead of either updating or ignoring the node. Replace both with the map() that updateRow already uses, which leaves the collection untouched when the id is absent. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Andy Scherzinger --- src/store/data.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/store/data.js b/src/store/data.js index 88caf3517b..9ed4ca3c6d 100644 --- a/src/store/data.js +++ b/src/store/data.js @@ -215,9 +215,8 @@ export const useDataStore = defineStore('data', { const stateId = genStateKey(isView, elementId) if (stateId && this.columns[stateId]) { - const col = res.data - const index = this.columns[stateId].findIndex(c => c.id === col.id) - this.columns[stateId][index] = parseCol(col) + const col = parseCol(res.data) + this.columns[stateId] = this.columns[stateId].map(c => c.id === col.id ? col : c) } return true @@ -381,8 +380,7 @@ export const useDataStore = defineStore('data', { const stateId = 'public-' + token if (this.rows[stateId]) { const row = res?.data?.ocs?.data - const index = this.rows[stateId].findIndex(r => r.id === rowId) - this.rows[stateId][index] = row + this.rows[stateId] = this.rows[stateId].map(r => r.id === rowId ? row : r) } return true },