1
You need to add cache contexts to your block. Cache contexts tell Drupal that the block needs to be cached differently for different circumstances. In your case, whether or not the user is logged in. you can read more about it here: https://www.drupal.org/docs/drupal-apis/cache-api/cache-contexts
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
caching × 13488 × 370
7 × 342
views × 115
theming × 106
blocks × 94
performance × 89
6 × 84
proxies × 65
database × 57
nodes × 40
entities × 39
users × 34
forms × 33
cron × 31
hooks × 26
routes × 26
drush × 26
javascript × 25
media × 23
ajax × 20
commerce × 17
navigation × 16
files × 13
panels × 13