The embedded view is visible only after reloading

Created on 29 February 2024, about 1 year ago
Updated 2 March 2024, about 1 year ago

Problem/Motivation

Using the module, I embedded a view in CKEditor. It contains media elements displayed in a flex slider. When I display the given node after emptying the cache, the view does not appear the first time, but if I reload the page, it is visible and working immediately. If I disable render cache, dynamic page cache, and page cache, it doesn't appear at all. The logfile and the inspector do not show any errors. I use drupal 10.2.3 and php 8.2.0.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: cannot reproduce

Version

2.0

Component

Code

Created by

🇭🇺Hungary peterszanto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @peterszanto
  • 🇩🇪Germany a.dmitriiev

    From your screenshot I see that the view HTML markup is displayed on the page, so it seems that the JS library is not attached and that is why you don't see the gallery slider itself. Right?

    What module is used for the view to have slider? Could you please provide a link to it? Do you know how the drupal library is attached to that view?

  • 🇭🇺Hungary peterszanto

    Hi!

    Thanks for the quick answer.
    I suppose you are right.

    I use the flexslider 3.0.0-alpha1

    You can see the page here, I use the modul at news :
    https://3peters.hu/mobilizmus/en
    for example: https://3peters.hu/mobilizmus/en/news/e-mobility-concept-szeged-adopted-...

    I don't know how the drupal library is attached to that view.

    if I refresh the page once, it works perfectly. I've cleared the caches just now.

  • 🇭🇺Hungary peterszanto

    The modul working perfectly if I use the slick caraousel or the views slideshow, so I do this. Thanks for help.

  • 🇩🇪Germany a.dmitriiev

    I had little time to check, but I see that flexslider adds its assets in a bit complex way, probably that is the reason, so when the view is rendered with this module, the assets are not attached.

    I might check it once again, but later.

  • Status changed to Closed: cannot reproduce about 1 year ago
  • 🇩🇪Germany a.dmitriiev

    I checked the flexslider module with insert view today and it is working for me. I have Drupal 10.2.3 with CKEditor 5, flexslider 3.0.0-alpha1 and insert_view_adv 2.0.0-alpha2.

    The only place I suspected is where the assets are attached in flexslider/templates/flexslider.theme.inc line 92. I thought $variables['attached'] was overwritten there, but it seems to work. You can try to change that code to something like this:

    // Finally, add the configuration to the page.
      $attached = flexslider_add($variables['attributes']['id'], $variables['flexslider']['settings']['optionset']);
      if (!isset($variables['#attached'])) {
        $variables['#attached'] = [];
      }
      $variables['#attached'] = array_merge($variables['#attached'], $attached);
    
Production build 0.71.5 2024