Skip to content

Conversation

@tsanislavgatev
Copy link
Contributor

to be discussed

@tsanislavgatev tsanislavgatev changed the title fix(framework): move element registration inside async fix(framework): move element registration inside async defineSequence Dec 18, 2025
@ui5-webcomponents-bot
Copy link
Collaborator

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview December 18, 2025 14:11 Inactive
Copy link
Contributor

@vladitasev vladitasev left a comment

Choose a reason for hiding this comment

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

Tag registration is explicitly sync in UI5Element.ts. We had it async in the past (what this change accomplishes), however we decided for the current approach because this is the expected behavior by most frameworks (we had Vue.js issues in particular).

The async part (message bundles, CLDR, etc.) is now awaited for in the rendering phase. Our thinking was - we can't delay tag registration, so we do it first, and then once everything is fetched, we await for definePromise before the first rendering.

This works well for 99% of the cases, however when we have public methods relying on CLDR to be fetched, as is the case here, there is no guarantee that CLDR will be loaded by the time the developer calls said public methods.

Therefore, we recommend to make these public methods async. They should explicitly await for the this.definePromise before doing any calculations. Technically, this will be a breaking change, so we either do it for 3.0, or mark them as deprecated and create new ones, f.e. getFormatAsync and we document that these are always safe to call, while the old ones are safe to call only after the element has been rendered at least once. Apps can decide to migrate to the new functions or stick to the old ones, if coincidentally it worked for them already.

We can discuss this topic next round.

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