Skip to content

Commit 15fb1bf

Browse files
authored
Merge pull request marmelab#10314 from marmelab/fix-useeditcontroller-mutation-meta
Fix `<Edit>` ignores mutation meta when updating the `getOne` cache
2 parents 2f22f09 + ee952a9 commit 15fb1bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/ra-core/src/dataProvider/useUpdate.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const useUpdate = <RecordType extends RaRecord = any, ErrorType = Error>(
116116
// otherwise the other side effects may not applied.
117117
const hasCallTimeOnSuccess = useRef(false);
118118

119-
const updateCache = ({ resource, id, data }) => {
119+
const updateCache = ({ resource, id, data, meta }) => {
120120
// hack: only way to tell react-query not to fetch this query for the next 5 seconds
121121
// because setQueryData doesn't accept a stale time option
122122
const now = Date.now();
@@ -274,6 +274,7 @@ export const useUpdate = <RecordType extends RaRecord = any, ErrorType = Error>(
274274
resource: callTimeResource,
275275
id: callTimeId,
276276
data,
277+
meta: mutationOptions.meta ?? paramsRef.current.meta,
277278
});
278279

279280
if (
@@ -441,6 +442,7 @@ export const useUpdate = <RecordType extends RaRecord = any, ErrorType = Error>(
441442
resource: callTimeResource,
442443
id: callTimeId,
443444
data: callTimeData,
445+
meta: callTimeMeta,
444446
});
445447

446448
// run the success callbacks during the next tick

0 commit comments

Comments
 (0)