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

Function useCreateTable

apps/sim/hooks/queries/tables.ts:513–530  ·  view source on GitHub ↗
(workspaceId: string)

Source from the content-addressed store, hash-verified

511 * Create a new table in a workspace.
512 */
513export function useCreateTable(workspaceId: string) {
514 const queryClient = useQueryClient()
515
516 return useMutation({
517 mutationFn: async (params: Omit<CreateTableBodyInput, 'workspaceId'>) => {
518 return requestJson(createTableContract, {
519 body: { ...params, workspaceId },
520 })
521 },
522 onError: (error) => {
523 if (isValidationError(error)) return
524 toast.error(error.message, { duration: 5000 })
525 },
526 onSettled: () => {
527 queryClient.invalidateQueries({ queryKey: tableKeys.lists() })
528 },
529 })
530}
531
532/**
533 * Add a column to an existing table.

Callers 1

TablesFunction · 0.90

Calls 3

requestJsonFunction · 0.90
isValidationErrorFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected