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

Function useBatchCreateTableRows

apps/sim/hooks/queries/tables.ts:835–859  ·  view source on GitHub ↗
({ workspaceId, tableId }: RowMutationContext)

Source from the content-addressed store, hash-verified

833 * Batch create rows in a table. Supports optional per-row positions for undo restore.
834 */
835export function useBatchCreateTableRows({ workspaceId, tableId }: RowMutationContext) {
836 const queryClient = useQueryClient()
837 const router = useRouter()
838
839 return useMutation({
840 mutationFn: async (
841 variables: BatchCreateTableRowsParams
842 ): Promise<BatchCreateTableRowsResponse> => {
843 return requestJson(batchCreateTableRowsContract, {
844 params: { tableId },
845 body: {
846 workspaceId,
847 rows: variables.rows as RowData[],
848 positions: variables.positions,
849 orderKeys: variables.orderKeys,
850 },
851 })
852 },
853 onError: (error) =>
854 notifyRowWriteError(error, () => router.push(buildUpgradeHref(workspaceId, 'tables'))),
855 onSettled: () => {
856 invalidateRowCount(queryClient, tableId)
857 },
858 })
859}
860
861/**
862 * Update a single row in a table.

Callers 2

TableGridFunction · 0.90
useTableUndoFunction · 0.90

Calls 5

requestJsonFunction · 0.90
buildUpgradeHrefFunction · 0.90
notifyRowWriteErrorFunction · 0.85
invalidateRowCountFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected