* 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 )
| 699 | * table. Used for cell edits where positions don't change. |
| 700 | */ |
| 701 | function 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 |
no outgoing calls
no test coverage detected