diff --git a/src/routes/index.lazy.tsx b/src/routes/index.lazy.tsx index 705872e..76681e4 100644 --- a/src/routes/index.lazy.tsx +++ b/src/routes/index.lazy.tsx @@ -24,6 +24,7 @@ export const Route = createLazyFileRoute('/')({ function Index() { const [data, setData] = useState(() => db.getData()) + const [tableKey, setTableKey] = useState(0) const [, setDeletedItems] = useState>(() => new Map()) const [uploadDialogOpen, setUploadDialogOpen] = useState(false); @@ -72,8 +73,9 @@ function Index() { const result = csvProcessor(csvData); if (result.success && result.results) { - const newData = setResults(result.results); - setData([...newData]); // Force a re-render by creating a new array + setResults(result.results); // Update the database + setData(result.results); // Update the state + setTableKey(prev => prev + 1); // Force table re-render setUploadDialogOpen(false); if (result.warnings) { @@ -156,7 +158,8 @@ function Index() {
- setData(updateResult(id, result))} onResultDelete={handleResultDelete}