ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

fix(ui5-date-picker): prevent errors when CLDR data is not loaded

Open hinzzx opened this issue 2 weeks ago • 1 comments

The CLDR data is loaded asynchronously during component definition via dynamic imports

customElements.whenDefined() resolves when the element is registered, not when async data is loaded

This caused a race condition where methods like isValidValue() could be called immediately after customElements.whenDefined() resolves, before the asynchronous CLDR data fetch completes.

DatePicker validation and formatting methods now return safe defaults when CLDR data is not yet loaded, instead of throwing errors.

Another possible solution would be to introduce a private event (something like 'cldr-load'), to re-render the component once the CLDR "becomes" available.

hinzzx avatar Dec 16 '25 09:12 hinzzx

🚀 Deployed on https://pr-12807--ui5-webcomponents-preview.netlify.app

ui5-webcomponents-bot avatar Dec 16 '25 09:12 ui5-webcomponents-bot

Overall these changes will prevent the errors in the console. However we should try to find a general solution regarding the issue with the CLDR. Also I think that will be good to add some logging in the PR when CLDR data is not loaded and try to use it.

The most efficient possible solution I discovered with the help of AI would bring breaking changes imo, so we should discuss those offline.

hinzzx avatar Dec 16 '25 14:12 hinzzx