Navigation render array is completely generated, even if the navigation bar is not rendered

Created on 29 April 2024, 24 days ago
Updated 18 May 2024, 5 days ago

Problem/Motivation

While working on πŸ› Font for navigation is preloaded in header even when navigation bar is not loaded Needs review realized that the whole navigation render array tree is generated, even if the user has no access to navigation bar.

Once the whole array is generated, visibility is handled via #access render array key. See repository.

This leads to an unnecessary code being executed for all the pages for anonymous users.

Steps to reproduce

  1. Set a breakpoint, or any other debugging tool, in UserNavigationBlock::build()
  2. Navigate across the site
  3. Confirm that UserNavigation::build() method is being executed unnecessarily

Proposed resolution

Move heavy logic in NavigationRenderer::buildNavigation() to a pre render callback or similar to ensure that it is executed if only the navigation bar is accessible by the current user.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

10.3 ✨

Component
NavigationΒ  β†’

Last updated about 1 hour ago

No maintainer
Created by

πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024