eufemia
eufemia copied to clipboard
Forms(ChildrenWithAge): fallback to using default locale when providing a non-existent locale
🐛 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.