Skip to content

Commit 56ac40c

Browse files
fix(table): drop run-mutation refetch so SSE patches aren't overwritten
useRunColumn.onSettled was canceling in-flight queries and invalidating the rows query — leftover behavior from the polling era. With the SSE stream now keeping the cache live via incremental patches, this refetch races the stream and snaps the cache back to whatever DB shows at the refetch moment, which can lag the just-arrived queued/running events. Cells appeared stuck on the optimistic 'pending' even though the SSE was delivering the real transitions.
1 parent df00f07 commit 56ac40c

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

apps/sim/hooks/queries/tables.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,14 +1236,10 @@ export function useRunColumn({ workspaceId, tableId }: RowMutationContext) {
12361236
onError: (_err, _variables, context) => {
12371237
if (context?.snapshots) restoreCachedWorkflowCells(queryClient, context.snapshots)
12381238
},
1239-
onSettled: async () => {
1240-
// Cancel any in-flight poll first — without this, a poll started during
1241-
// the mutation but lands AFTER it resolves can clobber the optimistic
1242-
// patch with stale data, producing a queued → cancelled → queued flicker
1243-
// before the authoritative refetch arrives.
1244-
await queryClient.cancelQueries({ queryKey: tableKeys.rowsRoot(tableId) })
1245-
await queryClient.invalidateQueries({ queryKey: tableKeys.rowsRoot(tableId) })
1246-
},
1239+
// No onSettled refetch — useTableEventStream keeps the cache live via SSE.
1240+
// A post-mutation refetch here would race the stream's incremental patches
1241+
// and snap the cache back to a DB snapshot, losing the just-arrived
1242+
// status transitions.
12471243
})
12481244
}
12491245

0 commit comments

Comments
 (0)