I have just finished my development and uploaded a website to a hosting. But unfortunately I've got another weird problem..

If I disable the site cache another template is used for rendering a view node. I cannot catch the error. The problem is that in case I disable all caches, this problem appears. But when I try to debug the problem it disappears)) So I am not able to find what is wrong with it ? Sometimes it appears after commenting these lines

#$settings['cache']['bins']['render'] = 'cache.backend.null';
#$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

Sometimes it appears after disabling Twig Debug

The problem that it swaps view node templates between two views. For exampl I have a view for rendering teasers, and another view is for rendering a node preview. So it swaps them. I really cannot understand what is going on and what is the problem.

Please suggest what can cause such weird behavior ?



The same problem occurs locally when I disable caches.


I've found the weird part of debug output

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_unformatted__latest_works' -->
   x views-view-unformatted--latest-works.html.twig
   x views-view-unformatted--latest-works.html.twig
   * views-view-unformatted.html.twig

The same template is suggested twice


I've noticed another weird behavior

#$settings['cache']['bins']['render'] = 'cache.backend.null';
#$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

Comment these lines the view on the main page doesn't work, outputs nodes with template from another page. Go to menu, Devel -> Clear Cache. Now view on the main page works correctly, but on the other page output nodes using template from the main page.

And these behavior repeats


The problem is caused by the render cache I guess. To get this error I have to do following steps :

  1. Consider there are two pages the front and the category page.
  2. If current page is displayed incorrectly, then stay on this page open admin panel, clear the site cache, refresh the page - everything is rendered correctly.
  3. Go to the category page, now it rendered incorrectly and nodes that are also present on the front page rendered incorrectly using the front page template.
  4. If I clear cache again and refresh the category page it will work, but the front page will be rendered using the view template from the category page.

I hope I've described the problem clearly. It seems that the problem is similar to that one https://www.drupal.org/node/2359955

  • 1
    Have you completely flushed the cache and is anything like memcache being used? Does the server have enough PHP memory?
    – Kevin
    Mar 16, 2017 at 20:41
  • @Kevin, thank for the reply, yes I cleared all caches, the same problem appears locally when I turn off the cache Mar 16, 2017 at 20:48
  • @Kevin please see my notes, I've added some information Mar 16, 2017 at 20:52
  • @Kevin I've reproduced the problem, please see my update Mar 16, 2017 at 21:15
  • 1
    That's not similar to the issue you linked, it is that issue. Per-view node templates don't work. Don't use them, define and use separate view modes. That's the only solution right now.
    – Berdir
    Mar 16, 2017 at 23:10

1 Answer 1


It seems that I've found a temporary solution to this problem.

Edit core/includes/entity.inc

Comment reset check lines.

function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $reset = FALSE) {
  $render_controller = \Drupal::entityManager()->getViewBuilder($entity->getEntityTypeId());
  //if ($reset) {
  return $render_controller->view($entity, $view_mode, $langcode);

If someone has the same problem, please let me know whether the solution works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.