Skip to content

Commit a821d4c

Browse files
fix(tables): guard importId on async cancel and drop mutation objects from deps
1 parent 0c702a2 commit a821d4c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/tables

apps/sim/app/workspace/[workspaceId]/tables/tables.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,11 @@ export function Tables() {
451451
useImportTrayStore.getState().endUpload(pendingId)
452452
// The server row drives the tray once the list refetches (mutation invalidates it).
453453
// If canceled mid-upload, flag the real id so it's not shown and cancel server-side.
454-
if (result?.tableId && useImportTrayStore.getState().consumeCanceled(pendingId)) {
454+
if (
455+
result?.tableId &&
456+
result.importId &&
457+
useImportTrayStore.getState().consumeCanceled(pendingId)
458+
) {
455459
useImportTrayStore.getState().cancel(result.tableId)
456460
void cancelTableImport(workspaceId, result.tableId, result.importId).catch(() => {})
457461
}
@@ -504,7 +508,8 @@ export function Tables() {
504508
}
505509
}
506510
},
507-
[workspaceId, router, uploadCsv, importCsvAsync]
511+
// eslint-disable-next-line react-hooks/exhaustive-deps -- mutation objects are unstable; mutateAsync is stable in v5
512+
[workspaceId, router]
508513
)
509514

510515
const handleListUploadCsv = useCallback(() => {

0 commit comments

Comments
 (0)