-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
What you were expecting:
<TranslatableInputs /> Component in <SimpleForm/> to work as described
What happened instead:
When I use a <TranslatableInputs> Component in my form, that was working previously as intended, an unhandled client error is thrown
Steps to reproduce:
Just have a backend record, that contains null values and use a <TranslatableInputs> Component in an Edit -> SimpleForm
Related code:
I've created a simple example here:
https://stackblitz.com/edit/github-n9ta2p?file=src%2FdataProvider.tsx
I use lifecycleCallbacks to inject a null value and some translations to a Post Record.
When you try to edit a "Post" the error get's thrown.
I identified getRecordPath in the useTranslatable hook that causes the problem
const getRecordPaths = (
record: any = {},
path: Array<string> = []
): Array<Array<string>> => { ... }
Environment
-
React-admin version: latest
-
Last version that did not exhibit the issue (if applicable):
-
React version: 18
-
Browser: Chrome
-
Stack trace (in case of a JS error):
Cannot convert undefined or null to objectat TranslatableInputsTabContent (https://jvmippmvrogithub-0oji--8080--41692973.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-7UR5SUYT.js?v=183729dc:33682:24)
at TranslatableContextProvider (https://jvmippmvrogithub-0oji--8080--41692973.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-7UR5SUYT.js?v=183729dc:5101:23)
at div
at https://jvmippmvrogithub-0oji--8080--41692973.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-6QB6VOP6.js?v=183729dc:2817:50
at TranslatableInputs (https://jvmippmvrogithub-0oji--8080--41692973.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-7UR5SUYT.js?v=183729dc:33754:15)