Forráskód Böngészése

fixed json cache bug on ajax home

Bachir Soussi Chiadmi 3 éve
szülő
commit
72c83bfc93

+ 6 - 5
web/modules/custom/materio_home/src/Controller/AjaxHomeController.php

@@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\language\ConfigurableLanguageManagerInterface;
 use Drupal\Core\Render\RendererInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Symfony\Component\HttpFoundation\JsonResponse;
 use Drupal\Core\Cache\CacheableJsonResponse;
 use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Url;
@@ -94,11 +95,11 @@ class AjaxHomeController extends ControllerBase {
         'languages:language_content'
       ]
     ];
-    // $response = new JsonResponse();
-    // $response->setData($data);
-    $response = new CacheableJsonResponse($data);
-    $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
-    $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($renderable));
+    $response = new JsonResponse();
+    $response->setData($data);
+    // $response = new CacheableJsonResponse($data);
+    // $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
+    // $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($renderable));
 
     return $response;
   }