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

fix: postpone menu-bar initial render to prevent re-layout #7312

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

web-padawan
Copy link
Member

@web-padawan web-padawan commented Apr 9, 2024

Description

Related to #7271

Type of change

  • Bugfix

Note

This change will require a fix to menuBarConnector.js to make sure menubar._buttons array is ready:

      generateItems: tryCatchWrapper((nodeId) => {
        if (!menubar.shadowRoot) {
          // workaround for https://github.com/vaadin/flow/issues/5722
          setTimeout(() => menubar.$connector.generateItems(nodeId));
          return;
        }

+       if (!menubar._container) {
+         // Menu-bar defers first buttons render to avoid re-layout
+         // See https://github.com/vaadin/web-components/issues/7271
+         queueMicrotask(() => menubar.$connector.generateItems(nodeId));
+         return;
+       }

@web-padawan web-padawan changed the title Fix/menu bar prevent relayout fix: postpone menu-bar initial render to prevent re-layout Apr 9, 2024
@web-padawan web-padawan force-pushed the fix/menu-bar-prevent-relayout branch from d669bd5 to 48d0e76 Compare April 9, 2024 12:55
@web-padawan web-padawan force-pushed the fix/menu-bar-prevent-relayout branch from ae44093 to b083d40 Compare April 10, 2024 08:37
@web-padawan web-padawan force-pushed the fix/menu-bar-prevent-relayout branch from b083d40 to 91aee18 Compare April 10, 2024 12:44
Copy link

sonarcloud bot commented Apr 10, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
4 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@web-padawan web-padawan marked this pull request as ready for review April 10, 2024 12:45
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

3 participants