Problem/Motivation
@catch:
This preview is still user-specific, which undermines having the #lazy_builder since it means the user cache context for the non-placeholdered render array too. I'm not sure we have standard patterns for this in core yet, the preview stuff is quite new, but can it use 'blurred text' or similar? Or just no preview at all maybe if it's not above the fold? The preview is mostly useful to avoid CLS.
@plopesc:go
Good catch!
My understanding was that #lazy_builder_preview was a generic placeholder and was not affected by caching properties.
Current core implementations are adding an empty placeholder like
['#markup' => '<a href="#" class="toolbar-tray-lazy-placeholder-link"> </a>']or just['#markup' => ' ']Would that help to solve the performance concerns?
Removing the placeholder completely causes some undesired glitches in the navigation bar when big_pipe is enabled
@nod_ :
static string is fine, it'll get replaced once loaded anyway
Proposed resolution
Agree on a lazy load strategy.
Remaining tasks
This issue should be resolved by the following issues. We are leaving this issue open solely to track the problem and make sure it goes away when these are resolved.
- #3441576: Add a new "Navigation user links" menu in favor of hardcoded links in NavigationUserBlock
- #3445993: Provide a NavigationLinkBlock Plugin and use Help as an usage example
- #3446116: Rename UserNavigationBlock to NavigationUserBlock for class name consistency
Comments
Comment #2
ckrinaComment #3
ckrinaComment #4
plopescWe can close this given that #3443559: Regression: Shortcuts menu flickers when the page is loaded showed the way to avoid flickering with no need to make an extra effort at render array level.
Same approach could be followed in the future if necessary.
Talked to @mherchel in the weekly Drupal Admin UI call and he also agreed.
Comment #5
catchI think there's still an issue here - it now looks like the preview isn't user-specific, but the caching of the preview still is. This could be verified by using the navigation with a couple of different users then checking the cache IDs in the cache_render table.
It could end up being a duplicate of #3441576: Add a new "Navigation user links" menu in favor of hardcoded links in NavigationUserBlock maybe though.
Comment #6
plopescThank you for the heads up!
Planned to deal with this as part of the mentioned issue #3441576: Add a new "Navigation user links" menu in favor of hardcoded links in NavigationUserBlock once the related issues #3445993: Provide a NavigationLinkBlock Plugin and use Help as an usage example & #3446116: Rename UserNavigationBlock to NavigationUserBlock for class name consistency are in and the ground is ready to mess with it.
We can leave this open as a reference and reminder in the meantime, though.
Comment #7
m4oliveiPostponing on #3445993: Provide a NavigationLinkBlock Plugin and use Help as an usage example (which is really close!!), per last comment by @plopsec.
Comment #8
mherchelUpdating IS
Comment #9
catchThis was resolved by #3441576: Add a new "Navigation user links" menu in favor of hardcoded links in NavigationUserBlock.