core/modules/tracker/tracker.pages.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index 967a131..78293b7 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -141,9 +141,11 @@ function tracker_page($account = NULL) { $page['#cache']['tags'] = $cache_tags; $page['#cache']['contexts'][] = 'user.node_grants:view'; + // Cacheable per "authenticated or not", because we can only track (and show) + // reading history for authenticated users, not for anonymous users. + $page['#cache']['contexts'][] = 'user.roles:authenticated'; if (Drupal::moduleHandler()->moduleExists('history') && \Drupal::currentUser()->isAuthenticated()) { $page['#attached']['library'][] = 'tracker/history'; - $page['#cache']['contexts'][] = 'user.roles:authenticated'; } return $page;