diff -u b/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php --- b/core/lib/Drupal/Core/Menu/LocalTaskManager.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php @@ -303,9 +303,7 @@ // Pre-fetch all routes involved in the tree. This reduces the number // of SQL queries that would otherwise be triggered by the access manager. $routes = $route_names ? $this->routeProvider->getRoutesByNames($route_names) : array(); - - // @todo add cacheability data in https://www.drupal.org/node/2511516 so - // that we are not re-building inaccessible links on every page request. + foreach ($tree as $level => $instances) { /** @var $instances \Drupal\Core\Menu\LocalTaskInterface[] */ foreach ($instances as $plugin_id => $child) { @@ -330,7 +328,6 @@ '#active' => $active, '#weight' => $child->getWeight(), '#access' => $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account, TRUE), - '#cache' => ['contexts' => ['route']], ]; } } diff -u b/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php b/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php --- b/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php +++ b/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php @@ -90,7 +90,7 @@ public function build() { $config = $this->configuration; $cacheable_metadata = new CacheableMetadata(); - $cacheable_metadata->addCacheContexts(['route.name']); + $cacheable_metadata->addCacheContexts(['route']); $tabs = [ '#theme' => 'menu_local_tasks', ]; reverted: --- b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -9,7 +9,6 @@ use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface; use Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait; -use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerInterface;