Skip to content

Commit b175db5

Browse files
authored
fix for BE side renderting and caching 2 types of content (#1161)
1 parent 42387de commit b175db5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Plugin/RenderingCacheContextPlugin.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,24 @@ public function __construct(
3939
* we set a different page variation, and the FPC stores a different cached page)
4040
*
4141
* @param HttpContext $subject
42+
* @param string[] $data
4243
*
4344
* @return array
4445
*/
45-
public function beforeGetVaryString(HttpContext $subject)
46+
public function afterGetData(HttpContext $subject, $data)
4647
{
4748
$storeId = $this->storeManager->getStore()->getId();
48-
if (! ($this->request->getControllerName() === 'category'
49-
&& $this->configHelper->replaceCategories($storeId) === true)) {
50-
return [];
49+
if (!($this->request->getControllerName() === 'category'
50+
&& $this->configHelper->replaceCategories($storeId) === true)) {
51+
return $data;
5152
}
5253

5354
$context = $this->configHelper->preventBackendRendering() ?
5455
self::RENDERING_WITHOUT_BACKEND :
5556
self::RENDERING_WITH_BACKEND;
5657

57-
$subject->setValue(self::RENDERING_CONTEXT, $context, self::RENDERING_WITH_BACKEND);
58+
$data[self::RENDERING_CONTEXT] = $context;
5859

59-
return [];
60+
return $data;
6061
}
6162
}

0 commit comments

Comments
 (0)