Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(framework): Add dynamic language change and on-demand rerendering #1746

Merged
merged 12 commits into from
Jun 11, 2020

Conversation

vladitasev
Copy link
Contributor

@vladitasev vladitasev commented Jun 8, 2020

You can test this change with the new RTL.html page in main.

This change adds:

  • A low-level method in RenderScheduler which allows to re-render all components on the page, only the rtlAware ones, only the languageAware ones, or both.
  • A setLanguage method in the configuration
  • A applyDirection method in base/scr/locale which re-renders rtl-aware components
  • The capability to re-fetch all message bundles when the language changes.

In order to be able to determine what to re-render, RenderScheduler needs to keep a Set of all active components on the page:

  • components that don't have a template are not registered/deregistered
  • components are registered on onEnterDOM
  • components are deregistered on onExitDOM
    The reason for this logic is that we don't want to keep references to elements forever, as that would prevent garbage collection. Instead we only re-render active elements.

In order to be able to determine which components are rtl-aware, we track their calls to the effectiveDir function. There is a small new registry for that purpose.

Additional changes:

  • utility method setToArray added because of IE support
  • fireEvent in EventProvider.js now returns an array of the results of all registered event listeners. This is very handy if these listeners do async work, and you want to wait for this work, as we do here in Language.js.

@vladitasev vladitasev changed the title feat(framework): Add the ability to re-render all components on the fly feat(framework): Add dynamic language change and on-demand rerendering Jun 9, 2020
@vladitasev vladitasev merged commit 1b568f2 into master Jun 11, 2020
@vladitasev vladitasev deleted the rerender-all branch June 11, 2020 10:26
@ilhan007 ilhan007 added this to 1.0.0-rc.8 (released) in UI5 Web Components - Roadmap Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants