eufemia icon indicating copy to clipboard operation
eufemia copied to clipboard

Forms(ChildrenWithAge): fallback to using default locale when providing a non-existent locale

Open langz opened this issue 6 months ago • 0 comments

🐛 Bug Report

As of today, when providing a non-existent locale to a Provider, ChildrenWithAge component fails and returns error:

Cannot read properties of undefined (reading 'hasChildren')

Reason is because it can't find the translations for the given locale(which doesn't exist). Anyhow, all other field components and regular eufemia components would not fail/break in the given scenario, but rather use the default locale in the given component.

To Reproduce

https://codesandbox.io/p/sandbox/goofy-leftpad-tym2l2?file=%2Fsrc%2FApp.tsx%3A7%2C5-7%2C44

Expected behavior

Fallback to use default locale instead of breaking.

Here's a branch/PR including a test, but not the actual fix yet.

langz avatar Aug 13 '24 11:08 langz