Problem/Motivation

We are meeting 2 issues related to ViewRows source since the merge of #3542796: Preview of view sources:

commit 4017275e9afd56edc1dc88731d903f21dbca449d
Date:   Tue Sep 1 08:19:28 2026 +0000
feat: #3542796 Preview of view sources

While editing the view entity

I pick Component ViewStyle plugin from UI Patterns, i select my SDC, and i add ViewsRows to a slot:
views rows

I submit the modal:

Uncaught PHP Exception Drupal\Component\Plugin\Exception\ContextException: "The display context is not a valid context." at /var/www/html/web/core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php

The ViewsRows has not been added to the slot.

While displaying the view entity

If I have already a View with ViewRows source in a ViewStyle plug, Infinite loops are created during the render (at least the "real" one, maybe also the preview one, to check):

Fatal error: Maximum call stack size of 2048000 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached during compilation. Try splitting expression in vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php on line 3

It looks similar to #3620678: Infinite recursion / fatal error rendering the front-end page when main_page_content is nested inside a component's slot but it is not sure yet it is the exact same problem because it didn't appears at the exact same commit.

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

just_like_good_vibes created an issue. See original summary.

pdureau’s picture

Title: Views regression » ViewRows source in a ViewStyle plugin
Issue summary: View changes
StatusFileSize
new37.33 KB

I have updated the description with more details.

Still investigating to narrow the issue.

just_like_good_vibes’s picture

guys, a quick analysis, in display_builder you need the "rows" but styled by the views style plugin, whereas the "views_rows" source of ui patterns, returns the raw views rows, before application of the style.
in the current codebase, you overwrite the ui patterns views rows source, where in fact, two sources should co-exist maybe?
before the bug, you were receiving the views rows, already styled, in the preprocess.

mogtofu33’s picture

Assigned: Unassigned » mogtofu33
Status: Active » Needs work

mogtofu33’s picture

Assigned: mogtofu33 » just_like_good_vibes
Status: Needs work » Needs review
pdureau’s picture

Issue summary: View changes

guys, a quick analysis, in display_builder you need the "rows" but styled by the views style plugin, whereas the "views_rows" source of ui patterns, returns the raw views rows, before application of the style.
in the current codebase, you overwrite the ui patterns views rows source, where in fact, two sources should co-exist maybe?
before the bug, you were receiving the views rows, already styled, in the preprocess.

Let's explore this idea:

Configuration ViewStyle Expectations of "Views Rows" in UI Patterns Expectations of "Views Rows" in Display Builder
Unformatted list (not applicable) The unformatted list
Table (not applicable) The table
Component (UI Patterns): Bootstrap Grid The raw list of renderable rows ⚠️ The Bootstrap Grid? Or the renderable rows?

So, we are maybe mixing 2 different things here... do we need 2 different plugins?

Configuration ViewStyle "Views Rows" plugin in UI Patterns "Views Rows" plugin in Display Builder New plugin (only in Display Builder)
Unformatted list (not usable) The raw list of renderable rows The unformatted list
Table (not usable) The raw list of renderable rows The table
Component (UI Patterns): Bootstrap Grid The raw list of renderable rows The raw list of renderable rows The Bootstrap Grid

To make the new plugin not available as a source of UI Patterns View Style plugin, we can play with the contexts. Today, we have this:

  • ComponentStyle::getFullContext():
    • ui_patterns_views:plugin:option (any)
    • ui_patterns_views:plugin:display_handler (any)
    • ui_patterns_views:rows (any)
    • ui_patterns_views:view_entity (entity:view)
    • ui_patterns_views:view (any)
    • requirements: views:style
  • ViewDisplay::getAvailableContexts():
    • display (string)
    • ui_patterns_views:rows (any)
    • ui_patterns_views:view_entity (entity:view)
    • requirements: views:style

What can we do?

EDIT: it took me half an hour to write the comment and I didn't see the ticket was already in review 😉

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Needs review » Needs work

Hello, thank you for this fix, but for me, it may not solve the root cause.
honestly, when i look at our problem, my favorite solution is that one :

- We add a new context requirement key called "views" (i.e. not views:rows, not views:style). This new context requirement key will be used by display builder, to indicate a views render context. You would inject that context requirement instead of the currently injected "views:style" (cf. return RequirementsContext::addToContext(['views:style'], $contexts); in \Drupal\display_builder_views\Plugin\display_builder\Buildable\ViewDisplay)
- We create right now in ui_patterns, all the appropriate views sources like you guys did. This will allow to create any view rendering using ui_patterns thanks to the newly context requirement "views". Of course most of the credit for the source code of those sources will be attributed to their original authors.
- We end up in display builder just using those sources (or deriving and swapping them if you need more features).

We will end up for a better couple ui_patterns + display_builder.

I created the issue #3620748: Add a views context and related sources.

just_like_good_vibes’s picture

just_like_good_vibes’s picture

just_like_good_vibes’s picture

i pushed the code for #3620748: Add a views context and related sources and everything seems ok.

the corresponding counterpart work on display_builder is here in a second branch (but the pipeline can't success here until ui_patterns issue is merged)

mogtofu33’s picture

Status: Needs work » Needs review

I like the UI Patterns approach, added little fix on the new MR for arguments.

mogtofu33 changed the visibility of the branch 3620706-view-rows-source-fatal to hidden.

mogtofu33’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.