Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
If multiple subrequests are used, then the last CurrentContext is cached and not re-evaluated.
Proposed resolution
Reset the internal caches of the current context when processing each request.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2863624--reset-current-context--2.patch | 1.1 KB | e0ipso |
|
Comments
Comment #2
e0ipsoProposed patch.
Comment #4
e0ipsoComment #5
dawehnerAn alternative solution could be: Store the actual context keyed by request.
Comment #6
e0ipso@dawehner interesting. What would be the benefit of that?
Comment #7
dawehnerYou'd not have to reset, but rather given you have a different active request, it would switch automatically.
\Drupal\Core\Render\Renderer::$contextCollection
is using that pattern for example.