Problem/Motivation
This would be a partial revert of #2451679: Validate cache contexts (+ cache contexts in some views plugins wrong). #2433591: Views using pagers should specify a cache context is also somewhat related. Discovered in #3395776: Make POST requests render cacheable.
The views.view.frontpage
view shipped with node module has the following cache contexts in the YAML export:
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url.query_args
- 'user.node_grants:view'
- user.permissions
In #3395776: Make POST requests render cacheable I am seeing these inconsistently applied on POST requests, resulting in cache misses where the could be hits. This is with the standard profile which has no node grants implementations.
when debugging, I see this on POST (#cache keys and contexts):
POST Array
(
[0] => view
[1] => frontpage
[2] => display
[3] => page_1
)
Array
(
[0] => languages:language_interface
[1] => url.query_args
[2] => user.node_grants:view
[3] => user.permissions
[4] => theme
)
And this on GET:
GET Array
(
[0] => view
[1] => frontpage
[2] => display
[3] => page_1
)
Array
(
[0] => user.permissions
[1] => languages:language_interface
[2] => theme
)
Cache contexts should be added via bubbling when the render cache is used (and depend on whether any modules implement node grants, the user permissions etc.), so I don't see where they're actually useful, or if they need to be semi-hardcoded like this, we should apply them everywhere.