- Issue created by @seanB
- Merge request !4Issue #3528613: AJAX placeholders starts a session and breaks page caching for anonymous users → (Merged) created by seanB
Automatically closed - issue fixed for 2 weeks with no activity.
The AJAX placeholder module uses the shared tempstore to store the callbacks for things it wants to render. When using AJAX placeholders for anonymous users, the shared tempstore creates a session in \Drupal\Core\TempStore\SharedTempStoreFactory::get()
:
// Use the currently authenticated user ID or the active user ID unless
// the owner is overridden.
if (!isset($owner)) {
$owner = $this->currentUser->id();
if ($this->currentUser->isAnonymous()) {
$owner = $this->requestStack->getSession()->get('core.tempstore.shared.owner', Crypt::randomBytesBase64());
}
}
The created session then breaks the Drupal page cache, since Drupal\Core\PageCache\RequestPolicy\NoSessionOpen
automatically denies the page cache for all users that have a session.
ajax_placeholder
elementSince the session is only created when no owner is passed to \Drupal\Core\TempStore\SharedTempStoreFactory::get()
, we should pass an owner ID.
Write a patch
Commit
None
None
Active
1.0
Code
Automatically closed - issue fixed for 2 weeks with no activity.