mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-18 20:56:43 +02:00
feat(ai): performance-first logic with store awareness extrapolation and change count fix
This commit is contained in:
1 parent
c5cacd9b5a
commit
259fb60638
3 files changed
+33
-16
No files matched your search
@@ -71,8 +71,21 @@ export const useGridStore = create<GridState>()(
|
||||
},
|
||||
|
||||
setDraftGamme: (codein, gamme) => {
|
||||
const draftChanges = { ...get().draftChanges, [codein]: gamme };
|
||||
set({ draftChanges, summary: computeSummary(get().rows, draftChanges) });
|
||||
const { rows, draftChanges: oldDrafts } = get();
|
||||
const originalRow = rows.find(r => r.codein === codein);
|
||||
const originalGamme = originalRow?.codeGamme;
|
||||
|
||||
const draftChanges = { ...oldDrafts };
|
||||
|
||||
if (gamme === originalGamme) {
|
||||
// If the new value matches initial, remove it from drafts
|
||||
delete draftChanges[codein];
|
||||
} else {
|
||||
// Otherwise, record the change
|
||||
draftChanges[codein] = gamme;
|
||||
}
|
||||
|
||||
set({ draftChanges, summary: computeSummary(rows, draftChanges) });
|
||||
},
|
||||
|
||||
resetDrafts: () => {
|
||||
|
||||
Reference in new issue
Block a user