Fix sort() mutating state in getter by copying array first

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 14:10:18 +08:00
parent 63fa11c44e
commit 1ac3d7cd5b

View File

@@ -81,10 +81,10 @@ export const useAllMapDataStore = defineStore("allMapDataStore", {
return state.allInsights; return state.allInsights;
}, },
traces: (state) => { traces: (state) => {
return state.allTrace.sort((x, y) => x.id - y.id); return [...state.allTrace].sort((x, y) => x.id - y.id);
}, },
baseTraces: (state) => { baseTraces: (state) => {
return state.allBaseTrace.sort((x, y) => x.id - y.id); return [...state.allBaseTrace].sort((x, y) => x.id - y.id);
}, },
cases: (state) => { cases: (state) => {
return state.allCase; return state.allCase;