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 ?
Thanks
NOTE 1
The same problem occurs locally when I disable caches.
NOTE 2
I've found the weird part of debug output
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_unformatted__latest_works' -->
<!-- FILE NAME SUGGESTIONS:
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
NOTE 3
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
FINALLY
The problem is caused by the render cache I guess. To get this error I have to do following steps :
- Consider there are two pages the
front
and thecategory
page. - 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.
- Go to the category page, now it rendered incorrectly and nodes that are also present on the
front
page rendered incorrectly using thefront
page template. - 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