From @wim-leers' comment at https://www.drupal.org/project/quicklink/issues/3047931#comment-13089045

While looking at the code, I did spot two problems, both relating to cacheability:

  1. $variables['#cache']['contexts'][] = 'session.exists'; should be inside the "if no_load_when_session" branch, to vary correctly — BigPipe does this too (see https://git.drupalcode.org/project/drupal/blob/c779a82a28c2e9f140f6a11db...) — this is still directly related to the originally reported problem
  2. $variables['#cache']['tags'] = $config->getCacheTags(); should be added immediately after loading $config to ensure that configuration changes are reflected immediately, without manual clearing of caches :) — this one I just noticed by looking at everything above.
CommentFileSizeAuthor
#2 3051856-quicklink-cache-2.patch1.66 KBmherchel

Comments

mherchel created an issue. See original summary.

mherchel’s picture

StatusFileSize
new1.66 KB

Patch with Wim's suggestions attached and tested.

mherchel’s picture

Status: Active » Needs review
wim leers’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +D8 cacheability

🥳🚢

mherchel’s picture

Status: Reviewed & tested by the community » Fixed

Commited to 8.x-1.x-dev!

  • mherchel committed 6a5818c on 8.x-1.x authored by Wim Leers
    Issue #3051856 by mherchel, Wim Leers: Ensure that caching is...

Status: Fixed » Closed (fixed)

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