Skip to content

Commit adbf9dd

Browse files
committed
chore(tables): remove stale comments and dead defensive code
- Fix chunkBatchUpdates JSDoc to reflect parallel dispatch (was "sequentially") - Inline CHUNK_CONCURRENCY=3, single-use constant needs no abstraction - Drop stale "Polls while any cell is in flight" from useTableRows JSDoc - Remove two generic "Validation errors surfaced by caller" comments - Remove ASCII separator line from workflow group mutations section - Remove dead `if (!variables) return` guard in useImportCsvIntoTable onSettled (TanStack v5 always provides variables to onSettled)
1 parent 6ad5523 commit adbf9dd

2 files changed

Lines changed: 4 additions & 17 deletions

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,10 @@ interface TableGridProps {
193193
}
194194

195195
/**
196-
* Split updates into chunks that fit within the server's batch-size limit,
197-
* running each chunk sequentially. Throws on first failure so callers see
198-
* an all-or-nothing result and partial success cannot leave the table in an
199-
* ambiguous half-cleared state.
196+
* Split updates into chunks bounded by the server batch-size limit, dispatching
197+
* up to 3 chunks concurrently. Throws on first failure — `Promise.all` rejects
198+
* immediately, so partial success cannot leave the table in an ambiguous state.
200199
*/
201-
const CHUNK_CONCURRENCY = 3
202-
203200
async function chunkBatchUpdates(
204201
updates: Array<{ rowId: string; data: Record<string, unknown> }>,
205202
mutateAsync: (args: {
@@ -213,7 +210,7 @@ async function chunkBatchUpdates(
213210
}
214211
let cursor = 0
215212
await Promise.all(
216-
Array.from({ length: Math.min(CHUNK_CONCURRENCY, chunks.length) }, async () => {
213+
Array.from({ length: Math.min(3, chunks.length) }, async () => {
217214
while (cursor < chunks.length) {
218215
await mutateAsync({ updates: chunks[cursor++]! })
219216
}

apps/sim/hooks/queries/tables.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,6 @@ interface InfiniteTableRowsParams {
210210
enabled?: boolean
211211
}
212212

213-
/**
214-
* Fetch a single page of rows for a table with pagination/filter/sort. Polls
215-
* while any cell is in flight so cells reach their terminal state without a
216-
* manual refresh.
217-
*/
218213
export function useTableRows({
219214
workspaceId,
220215
tableId,
@@ -416,7 +411,6 @@ export function useCreateTableRow({ workspaceId, tableId }: RowMutationContext)
416411
reconcileCreatedRow(queryClient, tableId, row)
417412
},
418413
onError: (error) => {
419-
// Validation errors are surfaced inline by the caller (see useUpdateColumn).
420414
if (isValidationError(error)) return
421415
toast.error(error.message, { duration: 5000 })
422416
},
@@ -771,7 +765,6 @@ export function useUpdateColumn({ workspaceId, tableId }: RowMutationContext) {
771765
queryClient.setQueryData(key, data)
772766
}
773767
}
774-
// Validation errors are surfaced as inline FieldErrors by the caller.
775768
if (isValidationError(error)) return
776769
toast.error(error.message, { duration: 5000 })
777770
},
@@ -1011,7 +1004,6 @@ export function useImportCsvIntoTable() {
10111004
logger.error('Failed to import CSV into table:', error)
10121005
},
10131006
onSettled: (_data, _error, variables) => {
1014-
if (!variables) return
10151007
invalidateRowCount(queryClient, variables.tableId)
10161008
},
10171009
})
@@ -1291,8 +1283,6 @@ export function useRunColumn({ workspaceId, tableId }: RowMutationContext) {
12911283
})
12921284
}
12931285

1294-
// ───────────────────────── Workflow group mutations ─────────────────────────
1295-
12961286
interface AddWorkflowGroupVariables {
12971287
group: WorkflowGroup
12981288
outputColumns: AddWorkflowGroupBodyInput['outputColumns']

0 commit comments

Comments
 (0)