Skip to content

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

Merged
web-padawan merged 2 commits into
mainfrom
fix/menu-bar-prevent-relayout
Apr 11, 2024
Merged

web-padawan merged 2 commits into
mainfrom
fix/menu-bar-prevent-relayout

Conversation

@web-padawan

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

Copy link
Copy Markdown
Member

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
@sonarqubecloud

sonarqubecloud Bot commented Apr 10, 2024 •

Copy link
Copy Markdown

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
@web-padawan
web-padawan requested a review from ugur-vaadin 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.

3 participants