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

Function useDeleteTable

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

Source from the content-addressed store, hash-verified

580 * Delete a table from a workspace.
581 */
582export function useDeleteTable(workspaceId: string) {
583 const queryClient = useQueryClient()
584
585 return useMutation({
586 mutationFn: async (tableId: string) => {
587 return requestJson(deleteTableContract, {
588 params: { tableId },
589 query: { workspaceId },
590 })
591 },
592 onError: (error) => {
593 if (isValidationError(error)) return
594 toast.error(error.message, { duration: 5000 })
595 },
596 onSettled: (_data, _error, tableId) => {
597 queryClient.invalidateQueries({ queryKey: tableKeys.lists() })
598 queryClient.removeQueries({ queryKey: tableKeys.detail(tableId) })
599 queryClient.removeQueries({ queryKey: tableKeys.rowsRoot(tableId) })
600 },
601 })
602}
603
604/**
605 * Create a row in a table.

Callers 2

TablesFunction · 0.90
TableFunction · 0.90

Calls 3

requestJsonFunction · 0.90
isValidationErrorFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected