MCPcopy Index your code
hub / github.com/simstudioai/sim / patchCachedRows

Function patchCachedRows

apps/sim/hooks/queries/tables.ts:701–716  ·  view source on GitHub ↗

* Apply a row-level transformation to all cached infinite row queries for this * table. Used for cell edits where positions don't change.

(
  queryClient: ReturnType<typeof useQueryClient>,
  tableId: string,
  patchRow: (row: TableRow) => TableRow
)

Source from the content-addressed store, hash-verified

699 * table. Used for cell edits where positions don't change.
700 */
701function patchCachedRows(
702 queryClient: ReturnType<typeof useQueryClient>,
703 tableId: string,
704 patchRow: (row: TableRow) => TableRow
705) {
706 queryClient.setQueriesData<InfiniteData<TableRowsResponse, TableRowsPageParam>>(
707 { queryKey: tableKeys.rowsRoot(tableId), exact: false },
708 (old) => {
709 if (!old) return old
710 return {
711 ...old,
712 pages: old.pages.map((page) => ({ ...page, rows: page.rows.map(patchRow) })),
713 }
714 }
715 )
716}
717
718/**
719 * A cached rows query whose ordering matches {@link reconcileCreatedRow}'s

Callers 2

useUpdateTableRowFunction · 0.85
useBatchUpdateTableRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected