Uploaded image for project: 'eZ Platform Enterprise Edition'
  1. eZ Platform Enterprise Edition
  2. EZEE-3460

Nested 'ez_content:viewAction' renders don't cache content properly

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • Customer request, 3.2.5, 3.3.2
    • 3.2.4, 3.3.1
    • None

    Description

      Steps to reproduce:

      1. Clean installation of Ibexa DXP.
      2. Create 2 or 3 Contents under main Ibexa Platform Content.
      3. Create the following pagelayout.html.twig file under themes/standard, example:
        <!doctype html>
        <html lang="{{ app.request.locale|replace({'_': '-'}) }}">
        <head>
            <link rel="icon" type="image/x-icon" href="{{ asset('bundles/ezplatformadminui/img/favicon.ico') }}" />
            <meta charset="utf-8">
            {% if content is defined and title is not defined %}
                {% set title = ez_content_name( content ) %}
            {% endif %}
            <title>{{ title|default( 'Home' ) }}</title>
            <meta name="generator" content="eZ Platform"/>
        
            {% block stylesheets %}
                {{ encore_entry_link_tags('app_styles') }}
            {% endblock %}
        </head>
        <body>
        {% block content %}
        {% endblock %}
        
        {{ render_esi(controller("App\\Controller\\DefaultController::index")) }}
        
        {% block javascripts %}
            {{ encore_entry_script_tags('app_js') }}
        {% endblock %}
        </body>
        </html>
        

        Include it in ezplatform.yaml file:

                site:
                    languages: [eng-GB]
                    pagelayout: themes/standard/pagelayout.html.twig
        
      4. Edit routes.yaml file:
        index:
            path: /
            controller: App\Controller\DefaultController::index
        
      5. Create DefaultController in src/Controller folder:
        <?php
        
        namespace App\Controller;
        
        use eZ\Publish\API\Repository\ContentService;
        use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
        use Symfony\Component\HttpFoundation\Response;
        
        class DefaultController extends AbstractController
        {
            private $contentService;
        
            public function __construct(ContentService $contentService)
            {
                $this->contentService = $contentService;
            }
        
            public function index(): Response
            {
                $content = $this->contentService->loadContent(42);
        
                return $this->render('index.html.twig', ['content' => $content]);
            }
        }
        
      6. Create index.html.twig and place it under templates folder. Insert the following code (Ids of Content should be taken out of newly created Content in step 2):
                    {{ render(controller('ez_content:viewAction', {contentId: 56,
                        viewType: 'line',
                        params:{
                            css_class:'category-capital'
                        }
                    } )) }}
                    {{ render(controller('ez_content:viewAction', {contentId: 42,
                        viewType: 'line',
                        params:{
                            css_class:'category-primary'
                        }
                    } )) }}
                    {{ render(controller('ez_content:viewAction', {contentId: 52,
                        viewType: 'line',
                        params:{
                            css_class:'category-secondary'
                        }
                    } )) }}
        
      7. Observe Network tab for example in Chrome browser when going to any Content's page - specifically watch Response headers.

      Result:
      Tags related to 3 Contents rendered by ez_content:viewAction don't appear in xkey header.

      Expected result:
      Tags related to 3 Contents rendered by ez_content:viewAction appear in xkey header.

      Note:
      This issue doesn't occur on v2.5.

      Seems like the problem occurs when we are trying to render root Content (ID = 52). It deletes tags of previously rendered Content (so 2 previously defined + own tags).

      Attachments

        Activity

          People

            Unassigned Unassigned
            bartlomiej.wajda@ibexa.co Bartłomiej Wajda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: