Navigation Bar implementation makes all pages uncacheable

Created on 29 March 2024, 6 months ago
Updated 15 April 2024, 5 months ago

Problem/Motivation

Issue split from 📌 Add tests for UserNavigationBlock Needs work .

The navigation bar implementation has a cache context per user in the global section that can not be placeholdered. This causes the Dynamic page cache to stop working, since the cardinality is too high.

Proposed resolution

Get rid of the context per user in navigation bar.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇸Spain plopesc Valladolid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @plopesc
  • 🇪🇸Spain plopesc Valladolid
  • Pipeline finished with Failed
    6 months ago
    Total: 245s
    #132345
  • 🇪🇸Spain plopesc Valladolid

    As part of the MR creation, commented the line suggested by @m4olivei in 📌 Add tests for UserNavigationBlock Needs work .

    It lead to some broken tests.

    Debugged it a it and found the issue in NavigationBlockCacheTest::testCachePermissions

    Cache tags before the change (Test pass):
    config:block_list config:navigation.navigation_block.administration_menu config:navigation.navigation_block.content_menu config:navigation.navigation_block.oxaw6wfu config:navigation.navigation_block.user config:navigation.settings config:system.menu.admin http_response navigation_block_view rendered user:2 user_view
    Cache tags after the change (Test fails):
    config:block_list config:navigation.navigation_block.administration_menu config:navigation.navigation_block.content_menu config:navigation.navigation_block.user config:navigation.settings config:system.menu.admin http_response navigation_block_view rendered user:2 user_view

    I'm missing the cache tag related to the test navigation block added during setup().

    My feeling is that reason behind failing test is that navigation bar cache tags are not properly invalidated or refreshed when a new navigation block is added.

    More digging in this one will be necessary. I'll try to continue with this next if anybody finds the root cause before.

  • Pipeline finished with Success
    6 months ago
    Total: 196s
    #134136
  • Status changed to Needs review 6 months ago
  • 🇪🇸Spain plopesc Valladolid

    MR created that replaces the problematic user cache context with user.permissions to make the navigation bar cacheable.

    As a secondary effect, we found that cache tags were not being implemented properly because navigation bar was not including automatically new navigation blocks added.

    Root cause seemed to be that navigation block list cache tag (config:navigation_block_list) was not included in the bar itself.

    Once the cache tag is added, tests are back to green and 'X-Drupal-Dynamic-Cache' header is not 'UNCACHEABLE' anymore.

    I believe this is ready for review now!

  • Status changed to RTBC 6 months ago
  • 🇨🇦Canada m4olivei Grimsby, ON

    Great work!

    That all makes logical sense to me. Ran through some tests on Tugboat, and it appears to be working well as well.

  • Pipeline finished with Skipped
    6 months ago
    #134478
  • Pipeline finished with Skipped
    6 months ago
    #134479
  • Status changed to Fixed 6 months ago
  • 🇨🇦Canada m4olivei Grimsby, ON

    Thanks again @plopesc.

    Merged to 1.x

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Pipeline finished with Success
    4 months ago
    Total: 203s
    #181327
  • Pipeline finished with Success
    3 months ago
    Total: 189s
    #197861
  • Pipeline finished with Failed
    24 days ago
    Total: 401s
    #266047
  • Pipeline finished with Failed
    24 days ago
    #266096
  • Pipeline finished with Failed
    23 days ago
    Total: 458s
    #267248
  • Pipeline finished with Failed
    17 days ago
    Total: 533s
    #273020
  • Pipeline finished with Failed
    16 days ago
    Total: 755s
    #273537
  • Pipeline finished with Failed
    16 days ago
    #273579
  • Pipeline finished with Failed
    16 days ago
    Total: 359s
    #273612
  • Pipeline finished with Failed
    16 days ago
    Total: 440s
    #273789
  • Pipeline finished with Failed
    16 days ago
    Total: 592s
    #273800
  • Pipeline finished with Failed
    16 days ago
    Total: 585s
    #273866
  • Pipeline finished with Failed
    16 days ago
    Total: 456s
    #273879
  • Pipeline finished with Failed
    16 days ago
    Total: 570s
    #273889
  • Pipeline finished with Failed
    16 days ago
    #273924
  • Pipeline finished with Failed
    16 days ago
    #274211
  • Pipeline finished with Failed
    16 days ago
    Total: 370s
    #274221
  • Pipeline finished with Failed
    16 days ago
    Total: 362s
    #274222
  • Pipeline finished with Failed
    16 days ago
    Total: 1166s
    #274470
  • Pipeline finished with Success
    15 days ago
    Total: 371s
    #274681
  • Pipeline finished with Failed
    15 days ago
    #274719
  • Pipeline finished with Failed
    15 days ago
    Total: 450s
    #274765
  • Pipeline finished with Success
    15 days ago
    Total: 471s
    #274773
  • Pipeline finished with Success
    15 days ago
    Total: 743s
    #274789
  • Pipeline finished with Success
    15 days ago
    Total: 480s
    #274907
  • Pipeline finished with Canceled
    15 days ago
    Total: 166s
    #274983
  • Pipeline finished with Success
    15 days ago
    Total: 426s
    #274984
  • Pipeline finished with Failed
    15 days ago
    Total: 485s
    #275434
  • Pipeline finished with Failed
    15 days ago
    Total: 482s
    #275444
  • Pipeline finished with Canceled
    15 days ago
    Total: 105s
    #275472
  • Pipeline finished with Success
    15 days ago
    Total: 443s
    #275473
  • Pipeline finished with Success
    15 days ago
    Total: 454s
    #275484
  • Pipeline finished with Failed
    14 days ago
    Total: 472s
    #275643
  • Pipeline finished with Success
    14 days ago
    Total: 406s
    #275654
  • Pipeline finished with Failed
    7 days ago
    Total: 546s
    #282327
  • Pipeline finished with Failed
    7 days ago
    Total: 347s
    #282415
  • Pipeline finished with Failed
    7 days ago
    #282443
  • Pipeline finished with Success
    7 days ago
    Total: 432s
    #282554
  • Pipeline finished with Canceled
    7 days ago
    Total: 80s
    #282750
  • Pipeline finished with Canceled
    7 days ago
    Total: 84s
    #282751
  • Pipeline finished with Success
    7 days ago
    Total: 345s
    #282753
Production build 0.71.5 2024