core/modules/user/user.module | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/modules/user/user.module b/core/modules/user/user.module index d9f6369..b176e6d 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1317,6 +1317,7 @@ function user_toolbar() { $user = \Drupal::currentUser(); // Add logout & user account links or login link. + $links_cache_contexts = []; if ($user->isAuthenticated()) { $links = array( 'account' => array( @@ -1338,6 +1339,8 @@ function user_toolbar() { 'url' => Url::fromRoute('user.logout'), ), ); + // The "Edit user account" link is per-user. + $links_cache_contexts[] = 'user'; } else { $links = array( @@ -1380,6 +1383,9 @@ function user_toolbar() { '#attributes' => array( 'class' => array('toolbar-menu'), ), + '#cache' => [ + 'contexts' => $links_cache_contexts, + ], ), ), '#weight' => 100,