{"record":{"id":"4903b01b998ba5e3","repo":"marmelab/react-admin","slug":"when-not-redirecting-after-editing-query-meta-and","errorCode":null,"errorMessage":"When not redirecting after editing, query meta and mutation meta should be the same, or you will have data update issues.","messagePattern":"When not redirecting after editing, query meta and mutation meta should be the same, or you will have data update issues\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/ra-core/src/controller/edit/useEditController.ts","lineNumber":106,"sourceCode":"            'useEditController requires an id prop or a route with an /:id? parameter.'\n        );\n    }\n    const id = propsId ?? routeId;\n\n    const { meta: queryMeta, ...otherQueryOptions } = queryOptions;\n    const {\n        meta: mutationMeta,\n        onSuccess,\n        onError,\n        ...otherMutationOptions\n    } = mutationOptions;\n\n    if (\n        (queryMeta || mutationMeta) &&\n        JSON.stringify(queryMeta) !== JSON.stringify(mutationMeta) &&\n        redirectTo === false\n    ) {\n        console.warn(\n            'When not redirecting after editing, query meta and mutation meta should be the same, or you will have data update issues.'\n        );\n    }\n\n    const {\n        registerMutationMiddleware,\n        getMutateWithMiddlewares,\n        unregisterMutationMiddleware,\n    } = useMutationMiddlewares();\n    const {\n        data: record,\n        error,\n        isLoading,\n        isFetching,\n        isPaused,\n        isPending,\n        isPlaceholderData,\n        refetch,","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-core/src/controller/edit/useEditController.ts#L88-L124","documentation":"useEditController warns when redirectTo === false but the queryOptions.meta and mutationOptions.meta passed to useEdit differ. Meta is used for optimistic-update cache matching; if query and mutation meta differ while staying on the same page, react-admin cannot reconcile the updated record with the cached query, causing stale or inconsistent displayed data.","triggerScenarios":"useEdit({ redirect: false, queryOptions: { meta: {...} }, mutationOptions: { meta: {...} } }) with the two meta objects not deep-equal (JSON.stringify comparison).","commonSituations":"Passing a meta containing timestamps, ids, or functions that differ per render; forgetting to mirror meta on mutationOptions when disabling redirect.","solutions":["Make queryOptions.meta and mutationOptions.meta identical (same keys and values).","If meta must differ, set a redirect target so the page remounts and the query refreshes.","Remove meta from the side that doesn't need it so both are undefined."],"exampleFix":"// before\nuseEdit({ redirect: false, queryOptions: { meta: { foo: 'bar' } }, mutationOptions: { meta: { baz: 'qux' } } });\n// after\nconst meta = { foo: 'bar' };\nuseEdit({ redirect: false, queryOptions: { meta }, mutationOptions: { meta } });","handlingStrategy":"validation","validationCode":"const meta = { tenantId: 't1' };\nif (redirectTo === false) {\n  if (JSON.stringify(queryMeta) !== JSON.stringify(mutationMeta)) {\n    throw new Error('queryOptions.meta must equal mutationOptions.meta when redirect is false');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Define meta once in a variable and reuse it for both queryOptions and mutationOptions.","Keep meta JSON-serializable (no functions, Dates, or unstable values).","Only use meta when your dataProvider actually needs it."],"tags":["data-fetching","cache","react-admin"],"backgroundTag":"cache-meta-mismatch","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}