From d98665fde03caa5617c6b6975399f31c61e1611d Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Thu, 23 Apr 2026 16:00:21 +0200 Subject: [PATCH] fix: preserve app edits from Supabase (shows in Change History) --- src/App.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 76337b4..40ecb27 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -166,9 +166,8 @@ export default function App() { // Start with Dropbox values (default) let finalRow = [...row]; - // Only preserve Supabase values if there's a PENDING manual edit - // NOT for 'synced' status - we want fresh Dropbox data to overwrite - if (synced && synced.status === 'pending') { + // Preserve Supabase values (edits made in the app) - this shows in Change History + if (synced) { // DETECT COLUMN SHIFT: If the saved data uses the old structure (where index 12 was a numeric date), // we need to shift all indices from 12 onwards by +1 to match today's Excel structure. const oldData = synced.data; @@ -187,9 +186,9 @@ export default function App() { finalRow[idx] = oldData[mergeIdx]; } }); - setRowStatuses(prev => ({ ...prev, [articleNo]: synced.status })); + setRowStatuses(prev => ({ ...prev, [articleNo]: synced.status || 'synced' })); } - // Otherwise use Dropbox values (default - will show 4.5 not 4.95) + // Otherwise use Dropbox values (don't merge, just process formatting) return finalRow.map((val: any, idx: number) => { if (val === undefined || val === null || val === '') return val;