Skip to content

Commit

Permalink
Fix more TS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Jul 2, 2024
1 parent 3358223 commit 3704e6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/dataProvider/useUpdateCache.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from 'react';
import type { GetListResult, Identifier } from 'react-admin';
import { useQueryClient } from 'react-query';
import { useQueryClient } from '@tanstack/react-query';
import type { ApiPlatformAdminRecord } from '../types.js';

const useUpdateCache = () => {
Expand Down Expand Up @@ -40,19 +40,19 @@ const useUpdateCache = () => {
}),
);
queryClient.setQueriesData(
[resource, 'getList'],
{ queryKey: [resource, 'getList'] },
(res: GetListResult<ApiPlatformAdminRecord> | undefined) =>
res?.data
? { data: updateColl(res.data), total: res.total }
: { data: [data] },
);
queryClient.setQueriesData(
[resource, 'getMany'],
{ queryKey: [resource, 'getMany'] },
(coll: ApiPlatformAdminRecord[] | undefined) =>
coll && coll.length > 0 ? updateColl(coll) : [data],
);
queryClient.setQueriesData(
[resource, 'getManyReference'],
{ queryKey: [resource, 'getManyReference'] },
(res: GetListResult<ApiPlatformAdminRecord> | undefined) =>
res?.data
? { data: updateColl(res.data), total: res.total }
Expand Down
2 changes: 1 addition & 1 deletion src/useOnSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const useOnSubmit = ({
});
});
failure(
mutateError as string | Error,
mutateError as Error,
{
data: values,
...(isCreate ? {} : { id, previousData: values }),
Expand Down

0 comments on commit 3704e6e

Please sign in to comment.