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

Function useAddTableColumn

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

Source from the content-addressed store, hash-verified

533 * Add a column to an existing table.
534 */
535export function useAddTableColumn({ workspaceId, tableId }: RowMutationContext) {
536 const queryClient = useQueryClient()
537
538 return useMutation({
539 mutationFn: async (column: CreateTableColumnBodyInput['column']) => {
540 return requestJson(addTableColumnContract, {
541 params: { tableId },
542 body: { workspaceId, column },
543 })
544 },
545 onError: (error) => {
546 if (isValidationError(error)) return
547 toast.error(error.message, { duration: 5000 })
548 },
549 onSettled: () => {
550 invalidateTableSchema(queryClient, tableId)
551 },
552 })
553}
554
555/**
556 * Rename a table.

Callers 3

ColumnConfigBodyFunction · 0.90
TableGridFunction · 0.90
useTableUndoFunction · 0.90

Calls 4

requestJsonFunction · 0.90
isValidationErrorFunction · 0.90
invalidateTableSchemaFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected