fixed json cache bug on ajax home
This commit is contained in:
parent
e6c452629c
commit
72c83bfc93
|
@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
|
||||||
use Drupal\language\ConfigurableLanguageManagerInterface;
|
use Drupal\language\ConfigurableLanguageManagerInterface;
|
||||||
use Drupal\Core\Render\RendererInterface;
|
use Drupal\Core\Render\RendererInterface;
|
||||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Drupal\Core\Cache\CacheableJsonResponse;
|
use Drupal\Core\Cache\CacheableJsonResponse;
|
||||||
use Drupal\Core\Cache\CacheableMetadata;
|
use Drupal\Core\Cache\CacheableMetadata;
|
||||||
use Drupal\Core\Url;
|
use Drupal\Core\Url;
|
||||||
|
@ -94,11 +95,11 @@ class AjaxHomeController extends ControllerBase {
|
||||||
'languages:language_content'
|
'languages:language_content'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
// $response = new JsonResponse();
|
$response = new JsonResponse();
|
||||||
// $response->setData($data);
|
$response->setData($data);
|
||||||
$response = new CacheableJsonResponse($data);
|
// $response = new CacheableJsonResponse($data);
|
||||||
$response->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
|
// $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
|
||||||
$response->addCacheableDependency(CacheableMetadata::createFromRenderArray($renderable));
|
// $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($renderable));
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue