@@ -466,6 +466,10 @@ export function useCreateTable(workspaceId: string) {
466466 body : { ...params , workspaceId } ,
467467 } )
468468 } ,
469+ onError : ( error ) => {
470+ if ( isValidationError ( error ) ) return
471+ toast . error ( error . message , { duration : 5000 } )
472+ } ,
469473 onSettled : ( ) => {
470474 queryClient . invalidateQueries ( { queryKey : tableKeys . lists ( ) } )
471475 } ,
@@ -532,6 +536,10 @@ export function useDeleteTable(workspaceId: string) {
532536 query : { workspaceId } ,
533537 } )
534538 } ,
539+ onError : ( error ) => {
540+ if ( isValidationError ( error ) ) return
541+ toast . error ( error . message , { duration : 5000 } )
542+ } ,
535543 onSettled : ( _data , _error , tableId ) => {
536544 queryClient . invalidateQueries ( { queryKey : tableKeys . lists ( ) } )
537545 queryClient . removeQueries ( { queryKey : tableKeys . detail ( tableId ) } )
@@ -818,6 +826,10 @@ export function useDeleteTableRow({ workspaceId, tableId }: RowMutationContext)
818826 body : { workspaceId } ,
819827 } )
820828 } ,
829+ onError : ( error ) => {
830+ if ( isValidationError ( error ) ) return
831+ toast . error ( error . message , { duration : 5000 } )
832+ } ,
821833 onSettled : ( ) => {
822834 invalidateRowCount ( queryClient , tableId )
823835 } ,
@@ -855,6 +867,10 @@ export function useDeleteTableRows({ workspaceId, tableId }: RowMutationContext)
855867
856868 return { deletedRowIds }
857869 } ,
870+ onError : ( error ) => {
871+ if ( isValidationError ( error ) ) return
872+ toast . error ( error . message , { duration : 5000 } )
873+ } ,
858874 onSettled : ( ) => {
859875 invalidateRowCount ( queryClient , tableId )
860876 } ,
@@ -1032,6 +1048,10 @@ export function useRestoreTable() {
10321048 params : { tableId } ,
10331049 } )
10341050 } ,
1051+ onError : ( error ) => {
1052+ if ( isValidationError ( error ) ) return
1053+ toast . error ( error . message , { duration : 5000 } )
1054+ } ,
10351055 onSettled : ( ) => {
10361056 queryClient . invalidateQueries ( { queryKey : tableKeys . lists ( ) } )
10371057 } ,
@@ -1068,11 +1088,12 @@ export function useUploadCsvToTable() {
10681088
10691089 return response . json ( )
10701090 } ,
1071- onSettled : ( ) => {
1072- queryClient . invalidateQueries ( { queryKey : tableKeys . lists ( ) } )
1073- } ,
10741091 onError : ( error ) => {
10751092 logger . error ( 'Failed to upload CSV:' , error )
1093+ toast . error ( error . message , { duration : 5000 } )
1094+ } ,
1095+ onSettled : ( ) => {
1096+ queryClient . invalidateQueries ( { queryKey : tableKeys . lists ( ) } )
10761097 } ,
10771098 } )
10781099}
@@ -1144,13 +1165,14 @@ export function useImportCsvIntoTable() {
11441165
11451166 return response . json ( )
11461167 } ,
1168+ onError : ( error ) => {
1169+ logger . error ( 'Failed to import CSV into table:' , error )
1170+ toast . error ( error . message , { duration : 5000 } )
1171+ } ,
11471172 onSettled : ( _data , _error , variables ) => {
11481173 if ( ! variables ) return
11491174 invalidateRowCount ( queryClient , variables . tableId )
11501175 } ,
1151- onError : ( error ) => {
1152- logger . error ( 'Failed to import CSV into table:' , error )
1153- } ,
11541176 } )
11551177}
11561178
@@ -1442,6 +1464,10 @@ export function useAddWorkflowGroup({ workspaceId, tableId }: RowMutationContext
14421464 body : { workspaceId, group, outputColumns } ,
14431465 } )
14441466 } ,
1467+ onError : ( error ) => {
1468+ if ( isValidationError ( error ) ) return
1469+ toast . error ( error . message , { duration : 5000 } )
1470+ } ,
14451471 onSettled : ( ) => {
14461472 invalidateTableSchema ( queryClient , tableId )
14471473 } ,
@@ -1468,6 +1494,10 @@ export function useUpdateWorkflowGroup({ workspaceId, tableId }: RowMutationCont
14681494 body : { workspaceId, ...vars } ,
14691495 } )
14701496 } ,
1497+ onError : ( error ) => {
1498+ if ( isValidationError ( error ) ) return
1499+ toast . error ( error . message , { duration : 5000 } )
1500+ } ,
14711501 onSettled : ( ) => {
14721502 invalidateTableSchema ( queryClient , tableId )
14731503 queryClient . invalidateQueries ( { queryKey : tableKeys . rowsRoot ( tableId ) } )
@@ -1488,6 +1518,10 @@ export function useDeleteWorkflowGroup({ workspaceId, tableId }: RowMutationCont
14881518 body : { workspaceId, groupId } ,
14891519 } )
14901520 } ,
1521+ onError : ( error ) => {
1522+ if ( isValidationError ( error ) ) return
1523+ toast . error ( error . message , { duration : 5000 } )
1524+ } ,
14911525 onSettled : ( ) => {
14921526 invalidateTableSchema ( queryClient , tableId )
14931527 queryClient . invalidateQueries ( { queryKey : tableKeys . rowsRoot ( tableId ) } )
0 commit comments