Overview
Earlier today, I used the latest Drupal Forge demo to test something. While there, I tried adding a pattern of the entire area above the copyright area at the bottom that includes the Drupal logo, menus, and social media icons.
It left out the Drupal logo and one menu but everything else was included. I forgot to check the logs.
On phone, so can’t grab a screenshot but didn’t want to forget reporting this
Steps to reproduce
- Use the DF XB Demo: https://www.drupalforge.org/template/drupal-cms-xb
- Go to Layers and scroll down for Flexible Slot
- Use "..." and choose "Create pattern"
- Drag the pattern into the page
- Note that the Drupal logo and first menu are missing




Proposed resolution
User interface changes
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | image.jpg | 260.2 KB | mayur-sose |
| #10 | sdds-xb-footer4-pattern-missing.png | 475.07 KB | kristen pol |
| #10 | sdds-xb-footer3-add-pattern.png | 230.26 KB | kristen pol |
| #10 | sdds-xb-footer2-create-pattern.png | 233.15 KB | kristen pol |
| #10 | sdds-xb-footer1.png | 435.16 KB | kristen pol |
Issue fork experience_builder-3535078
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
kristen polThat’s from the demo design system
Comment #3
wim leersThis sounds a lot like #3534971: ApiLayoutController::getRegionForComponentInstance doesn't work well with nested components if there are multiple regions.. 🤔
Comment #4
wim leersLooking forward to the additional info to reproduce this! 😊🙏
Comment #5
heyyo commentedI also saw this issue outside xb-demo, and I didn't have any region enabled in my theme to be managed by XB.
Comment #6
heyyo commentedI just checked, the POST request xb/api/v0/config/pattern doesn't contain the full tree of the selected component.
Comment #7
wim leersI see, so then … it must be a client-side problem? But the video in #6 does not show the request body, so it could still be the same back-end bug that causes the information the client sent to get lost 😅
I'm going to bet that this is a back-end bug, and just another symptom of #3534971-6: ApiLayoutController::getRegionForComponentInstance doesn't work well with nested components if there are multiple regions.. Bumping the priority of that one. Odd that this was found so late!
Comment #8
heyyo commentedright payload is ok, so backend issue.

Comment #9
wim leersYeah then I'm 99% confident it's a duplicate of that other isssue. 😇
Let's first land that other issue, then test again here.
Comment #10
kristen polComment #11
mayur-sose commentedI added several nested code components inside two-column components and created a pattern with them. However, I noticed that some components were not included in the resulting pattern. @wim-leers this issue is not resolved with #3534971
Comment #12
lauriiiComment #13
lauriiiComment #14
wim leersToo bad #3534971: ApiLayoutController::getRegionForComponentInstance doesn't work well with nested components if there are multiple regions. didn't solve it. It's the same fundamental problem.
In this case though,
\Drupal\experience_builder\Controller\ApiConfigControllers::post()is what createsPattern(and other) XB config entities. That callsPattern::createFromClientSide(), which ends up calling\Drupal\experience_builder\Controller\ClientServerConversionTrait::convertClientToServer().Apparently
ApiLayoutControllercontains an alternative implementation of fundamentally the same logic 😞 That's been a known issue for months. We've been prioritizing new features over refactoring/cleaning up, so I'm not surprised we never got to those.My latest thinking and write-up about this was … on February 20 (almost 5 months ago!!!) at #3503239-4: [PP-1] Make use of the serializer for normalizing/denormalizing config entities in ApiConfigControllers.
Comment #15
thoward216 commentedComment #16
thoward216 commentedI've started some investigation into this and it doesn't look to be the same issue as #3534971 and looks to be due to #3526127 and the way that the function generateComponentTreeKeys() builds the keys.
The array that is passed into the generateComponentTreeKeys() function contains all 10 items in the tree in my case, but when I go through the function I only end up with 8 items.
I did a test by commenting out the set() function in Pattern entity and everything saves as expected so that looks to prove where the root cause looks to be. Will continue to debug this further.
Comment #17
larowlanWill try to move this along a bit while @thoward216 sleeps 🧚♀️
Comment #18
larowlanComment #19
larowlanWas able to write a test using @thoward216's excellent sleuth work at #16 - confirming this is not related to #3534971: ApiLayoutController::getRegionForComponentInstance doesn't work well with nested components if there are multiple regions. or #3526127: Ensure deterministic config export order of config-defined component trees
Pushed a failing test replicating #16
Comment #20
larowlanAs the bug is in
\Drupal\experience_builder\Plugin\Field\FieldType\ComponentTreeItemListInstantiatorTrait::generateComponentTreeKeys, this also impacts ContentTemplates - new titleComment #21
larowlanPushed a fix with some expanded docs of what is going on in that method.
Comment #23
thoward216 commentedThanks @larowlan - I've manually tested this and everything is working as expected and the output of the component tree keys is what I was expecting to see also. I've just opened an MR to run the pipeline.
Comment #24
larowlanWhoops I forgot that, thanks
Comment #25
thoward216 commentedComment #26
isholgueras commentedI've left some minor comments. Overall, It looks good to me though
Comment #27
wim leersTest-only CI job failed 👍
Requested a few clarifications, specifically around the
continue— I'm not convinced yet it is necessary. It's better to fail explicitly than silently ignore problems — unless there's a good reason, and then that should be documented 🙏Comment #28
thoward216 commentedComment #29
wim leersComment #30
wim leersAFAICT this could also affect
PageRegions, because that's the third config entity type that relies on\Drupal\experience_builder\Plugin\Field\FieldType\ComponentTreeItemListInstantiatorTrait::generateComponentTreeKeys()This boils down to data loss, so … tagging .
Comment #31
wim leersAfter writing #30, one thing didn't sit right: we're only adding test coverage for
Pattern, but per @larowlan in #20, this affectsContentTemplates too, and per my #30,PageRegions too.We should test all 3, generically. Made it so.
Comment #32
wim leersIOW this was a bug in #3526127: Ensure deterministic config export order of config-defined component trees — the test coverage that that added and this issue expanded has now been generalized using a new
\Drupal\Tests\experience_builder\Kernel\Config\ConfigWithComponentTreeTestBase.I expect linting errors but tests to pass — will fix after lunch 👍
Comment #34
wim leersComment #35
wim leers@lauriii confirmed the backporting of this to
0.xin Slack :)Comment #37
balintbrews