Skip to content

Conversation

@hinzzx
Copy link
Contributor

@hinzzx hinzzx commented Dec 16, 2025

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

So there is 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.

@ui5-webcomponents-bot
Copy link
Collaborator

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview December 16, 2025 09:47 Inactive
@GDamyanov GDamyanov self-requested a review December 16, 2025 11:30
Copy link
Contributor

@GDamyanov GDamyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

if (!format) {
return false;
}
const date = format.parse(dateString);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that if there is no format will be good to return false

Copy link
Contributor Author

@hinzzx hinzzx Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s why we have a fallback. I think it's the safest approach.

@hinzzx
Copy link
Contributor Author

hinzzx commented Dec 16, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants