fixed json cache bug on ajax home
This commit is contained in:
		@@ -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;
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user