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

Function useRenameTable

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

Source from the content-addressed store, hash-verified

556 * Rename a table.
557 */
558export function useRenameTable(workspaceId: string) {
559 const queryClient = useQueryClient()
560
561 return useMutation({
562 mutationFn: async ({ tableId, name }: { tableId: string; name: string }) => {
563 return requestJson(renameTableContract, {
564 params: { tableId },
565 body: { workspaceId, name },
566 })
567 },
568 onError: (error) => {
569 if (isValidationError(error)) return
570 toast.error(error.message, { duration: 5000 })
571 },
572 onSettled: (_data, _error, variables) => {
573 queryClient.invalidateQueries({ queryKey: tableKeys.detail(variables.tableId) })
574 queryClient.invalidateQueries({ queryKey: tableKeys.lists() })
575 },
576 })
577}
578
579/**
580 * Delete a table from a workspace.

Callers 3

TablesFunction · 0.90
TableFunction · 0.90
useTableUndoFunction · 0.90

Calls 3

requestJsonFunction · 0.90
isValidationErrorFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected