Closed (works as designed)
Project:
Drupal core
Version:
8.3.3
Component:
cache system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Sep 2017 at 08:46 UTC
Updated:
30 Sep 2017 at 17:13 UTC
Jump to comment: Most recent
Comments
Comment #2
mrphilipwarner commentedComment #3
maacl commentedYou most likely have to set the cache context for your custom block, see https://www.drupal.org/docs/8/api/cache-api/cache-contexts and for examples: https://drupal.stackexchange.com/questions/199527/how-do-i-correctly-setup-caching-for-my-custom-block-showing-content-depending-o.
Comment #4
mrphilipwarner commentedThank you!
I added the following cache item to the return array and it's working now!
Comment #5
maacl commentedThis should be enough in this case. If you happen to render other content (like nodes) inside your block you have to embed the getCacheContexts() function and merge the contexts to have a proper bubbling of contexts.