Skip to content

[useTranslatable::getRecordPath] - record with "null" value causes a client error | Edit with <TranslatableInputs> #10107

@glauff

Description

@glauff

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions