Problem/Motivation

Steps to reproduce

- Create a new view
- add page, output some teasers using custom elements-style
- no other changes, minimal setup

Result:
- the row-wrapper is an empty string "".
- With the default vue template of the nuxt-starter, this ends in an error when rendering in the frontend, since an empty string does not make the vue component apply the default
- Error: "src.replace is not a function\n"

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fago created an issue.

fago’s picture

This seems to fix it:

 diff --git
     a/modules/lupus_decoupled_views/src/Plugin/views/display/CustomElementsViewsDisplayTrait.php
     b/modules/lupus_decoupled_views/src/Plugin/views/display/CustomElementsViewsDisplayTrait.php
     index 678911d..fc65094 100644
     ---
     a/modules/lupus_decoupled_views/src/Plugin/views/display/CustomElementsViewsDisplayTrait.php
     +++
     b/modules/lupus_decoupled_views/src/Plugin/views/display/CustomElementsViewsDisplayTrait.php
     @@ -104,8 +104,8 @@ trait CustomElementsViewsDisplayTrait {
          // wrapper-element-name separately. That way the view's frontend component
          // can do the wrapping and stays more flexible.
          $rows_wrapper_element = $render['#rows']['#custom_element'] ?? NULL;
     -    // Set empty string for default 'drupal-markup', pass custom wrapper name.
     -    $rows_wrapper = $rows_wrapper_element && $rows_wrapper_element->getTag() !==
     'drupal-markup' ? $rows_wrapper_element->getTag() : '';
     +    // Pass custom wrapper tag, or NULL when the default drupal-markup is used.
     +    $rows_wrapper = $rows_wrapper_element && $rows_wrapper_element->getTag() !==
     'drupal-markup' ? $rows_wrapper_element->getTag() : NULL;
          $custom_element->setAttribute('rows_wrapper', $rows_wrapper);
          $custom_element->setSlotFromNestedElements('rows', $rows);

Let's do a proper MR with test-coverage that asserts that the output leaves out the wrapper attribute then.