Overview
We recently faced an issue where we couldn't use nested components in an XB page that has multiple regions.
Steps to reproduce
- Have multiple regions set up.
- Place two components one with a prop and another one with a slot in a component with slots.
- Place another component with a prop inside the nested component.
- Fill the value of prop in first component. This one works.
- Fill the value of prop in 2nd component.(The one in nested component).
- See that the network call for this last one fails with 5xx error.
Expected result
Nested components should work well.
This fails at ApiLayoutController::267 because $regionForComponentId is null and it's not able to get the region even though content region exists under which this component is placed.
Proposed resolution
User interface changes
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | payload-500-error.txt | 1.21 KB | amangrover90 |
| Screenshot 2025-07-09 at 7.33.24 PM.png | 786.89 KB | amangrover90 |
Issue fork experience_builder-3534971
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
Comment #2
amangrover90 commentedComment #3
amangrover90 commentedComment #4
wim leersThat's
So … this would mean that
$page_regions[$regionForComponentId]resolves toNULL, meaning that$regionForComponentIdis NOT one of the existingPageRegionconfig entities?! 😱Can you please apply this patch to get a more precise error message?
Comment #5
wim leersOh wait:
If true, this would most likely be a bug in
\Drupal\experience_builder\Controller\ApiLayoutController::getRegionForComponentInstance()?What would be really helpful is you sharing the full request body that triggered that 500 response 🙏 That would allow us to easily write a failing test case to
ApiLayoutControllerPatchTest.Comment #6
mglamanI walked through the xdebug of this. The component was in the `content` region. I think the bug is in the `slots` code
It was nested 2 or 3 levels deep.
Comment #7
wim leersComment #8
wim leersBumping priority and tagging , because AFAICT #3535078: Bug in `generateComponentTreeKeys()` causes XB config entity containing a component tree to loses some component instances upon creation is a duplicate bug report!
Tom, could you take a look at this today? 🙏
Comment #9
amangrover90 commentedUploaded the payload for which there was 500 error. It fails trying to calculate the regionForComponentId.
Comment #10
wim leersThis blocks #3535078, see #3535078-9: Bug in `generateComponentTreeKeys()` causes XB config entity containing a component tree to loses some component instances upon creation. More likely: that is a duplicate of this issue: different symptom, same root cause. Still, let's double-check there after this lands 👍
Comment #12
wim leersComment #14
isholgueras commentedThis is ready with all tests green. Let me know if we can create a follow-up ticket for tests or if we should include here the tests
Comment #15
wim leersYes, we do, hence the tag 😇
See #9 for a sample payload, but it sounds like you were able to reproduce this yourself already :)
Comment #16
wim leersComment #18
larowlanI think this should be a beta blocker, its pretty easy to get this error.
Pushed a failing test and rebased off 0.x
If you checkout 185d8c32 and run ApiLayoutControllerPatchTest it fails.
We already had most of the required structure in XbTestSetup, just needed to do some fernangling to mirror the nesting.
Adding the tag, asking for forgiveness not permission etc
Comment #19
wim leers2 questions on the MR — one about a remaining
@todo, one about something I don't understand.Comment #20
wim leersThanks!
Landing #3530258: Add rudimentary conflict prevention to the Config Auto-save endpoint first though.
Comment #21
isholgueras commentedSure! feel free to throw it back to me if we need a reroll here.
Comment #22
penyaskitoI have a follow-up MR ready at https://git.drupalcode.org/project/experience_builder/-/merge_requests/1269.
Comment #23
wim leers#3530258: Add rudimentary conflict prevention to the Config Auto-save endpoint is in! Merging this as soon as CI passes.
@penyaskito THAT WAS FAST 😱
Comment #25
wim leers