Skip to content

Commit e39a545

Browse files
authored
Merge pull request #159 from DN-Amsterdam/#158-fix-preview-server-error
#158 Fix error for cached endpoints on preview
2 parents 51dc2fa + df3a0b7 commit e39a545

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/controllers/DefaultController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ public function actionIndex(string $pattern): Response
8989
$this->response->getHeaders()->setDefault('X-Robots-Tag', 'none');
9090

9191
// Before anything else, check the cache
92-
if (!($this->request->getIsPreview() || $this->request->getIsLivePreview())) {
93-
$cache = ArrayHelper::remove($config, 'cache', true);
94-
} else {
92+
$cache = ArrayHelper::remove($config, 'cache', true);
93+
if ($this->request->getIsPreview() || $this->request->getIsLivePreview()) {
94+
// Ignore config & disable cache for live preview
9595
$cache = false;
9696
}
97-
97+
9898
$cacheKey = ArrayHelper::remove($config, 'cacheKey')
9999
?? implode(':', [
100100
'elementapi',

0 commit comments

Comments
 (0)