City-of-Bloomington / drupal-customizations

Drupal version management using composer
https://bloomington.in.gov
GNU General Public License v2.0
1 stars 1 forks source link

Node revisions cannot be viewed #27

Closed charlesbrandt closed 6 years ago

charlesbrandt commented 6 years ago

When looking at the node revisions page in Drupal, clicking on one of the times yields:

The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\ContextException: Required contexts without a value: node. in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 96 of core/lib/Drupal/Core/Plugin/Context/ContextHandler.php).

For example: https://bloomington.in.gov/node/110/revisions/12401/view

inghamn commented 6 years ago

The way we're declaring cache contexts for blocks in our custom modules is tripping over this bug. Trying to view a revision happens over a different route, and our declared cache context is only for the node view. This means, as written, our block does not have a cache context for the node.

Drupal is supposed to not crash when this happens. It's supposed to execute the block with no caching. However, there are bugs that have been outstanding for years on this topic.

https://www.drupal.org/project/drupal/issues/2620126 https://www.drupal.org/project/drupal/issues/2677162

All this means that our custom modules' blocks must be very careful about cache context declarations. They must:

inghamn commented 6 years ago

Revisions are now viewable