Skip to content

Commit cddfa8e

Browse files
committed
fix(ResourceListView): improve error handling and reset file state on mutation error
1 parent f29142c commit cddfa8e

File tree

1 file changed

+16
-16
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/resources/components

1 file changed

+16
-16
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/resources/components/ResourceListView.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ export const ResourceListView = ({ data, refetch }: ResourceListProps) => {
109109
);
110110
},
111111
onError: (err: any) => {
112-
console.log('Error ::: ', err);
113-
},
112+
toast(err.message || String(err));
113+
setFile([])
114+
}
115+
114116
}
115117
);
116118

@@ -215,23 +217,21 @@ export const ResourceListView = ({ data, refetch }: ResourceListProps) => {
215217

216218
return (
217219
<div className="mt-3">
218-
<div className="my-8 flex justify-between flex-wrap items-center gap-6 ">
219-
<div className='flex items-center flex-wrap gap-2'>
220-
<Text>
221-
Showing {filteredRows.length} of {filteredRows.length} Data Files
222-
</Text>
223-
<SearchInput
224-
placeholder="Search in Resources"
225-
label="Search"
226-
name="Search"
227-
onChange={(e) => handleSearchChange(e)}
228-
/>
220+
<div className="my-8 flex flex-wrap items-center justify-between gap-6 ">
221+
<div className="flex flex-wrap items-center gap-2">
222+
<Text>
223+
Showing {filteredRows.length} of {filteredRows.length} Data Files
224+
</Text>
225+
<SearchInput
226+
placeholder="Search in Resources"
227+
label="Search"
228+
name="Search"
229+
onChange={(e) => handleSearchChange(e)}
230+
/>
229231
</div>
230232
<Dialog>
231233
<Dialog.Trigger>
232-
<Button size="medium" >
233-
ADD NEW DATA FILE
234-
</Button>
234+
<Button size="medium">ADD NEW DATA FILE</Button>
235235
</Dialog.Trigger>
236236
<Dialog.Content title={'Add New Resource'}>
237237
{createResourceMutation.isLoading ? (

0 commit comments

Comments
 (0)