- Issue created by @Kristen Pol
- ๐บ๐ธUnited States Kristen Pol Santa Cruz, CA, USA
Thatโs from the demo design system
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
This sounds a lot like ๐ ApiLayoutController::getRegionForComponentInstance doesn't work well with nested components if there are multiple regions. Active . ๐ค
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Looking forward to the additional info to reproduce this! ๐๐
- ๐ฎ๐ฑIsrael heyyo Jerusalem
I also saw this issue outside xb-demo, and I didn't have any region enabled in my theme to be managed by XB.
- ๐ฎ๐ฑIsrael heyyo Jerusalem
I just checked, the POST request xb/api/v0/config/pattern doesn't contain the full tree of the selected component.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I 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!
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Yeah then I'm 99% confident it's a duplicate of that other isssue. ๐
Let's first land that other issue, then test again here.
I 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
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Too bad ๐ ApiLayoutController::getRegionForComponentInstance doesn't work well with nested components if there are multiple regions. Active 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
ApiLayoutController
contains 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 โ .
- ๐ฌ๐งUnited Kingdom thoward216
I'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.
- ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Will try to move this along a bit while @thoward216 sleeps ๐งโโ๏ธ
- ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Was able to write a test using @thoward216's excellent sleuth work at #16 - confirming this is not related to ๐ ApiLayoutController::getRegionForComponentInstance doesn't work well with nested components if there are multiple regions. Active or ๐ Ensure predictable config export order of config-defined component trees Active
Pushed a failing test replicating #16
- ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
As the bug is in
\Drupal\experience_builder\Plugin\Field\FieldType\ComponentTreeItemListInstantiatorTrait::generateComponentTreeKeys
, this also impacts ContentTemplates - new title - ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Pushed a fix with some expanded docs of what is going on in that method.
- @thoward216 opened merge request.
- ๐ฌ๐งUnited Kingdom thoward216
Thanks @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.
- ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Whoops I forgot that, thanks
- ๐ช๐ธSpain isholgueras
I've left some minor comments. Overall, It looks good to me though
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
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 ๐ - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
AFAICT this could also affect
PageRegion
s, 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 .
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
After writing #30, one thing didn't sit right: we're only adding test coverage for
Pattern
, but per @larowlan in #20, this affectsContentTemplate
s too, and per my #30,PageRegion
s too.We should test all 3, generically. Made it so.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
IOW this was a bug in ๐ Ensure predictable config export order of config-defined component trees Active โ 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 ๐
-
wim leers โ
committed 8f4d9f7f on 1.x authored by
thoward216 โ
Issue #3535078 by wim leers, larowlan, thoward216, kristen pol, heyyo,...
-
wim leers โ
committed 8f4d9f7f on 1.x authored by
thoward216 โ
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
@lauriii confirmed the backporting of this to
0.x
in Slack :) -
balintbrews โ
committed eea81eeb on 0.x authored by
thoward216 โ
Issue #3535078 by wim leers, larowlan, thoward216, kristen pol, heyyo,...
-
balintbrews โ
committed eea81eeb on 0.x authored by
thoward216 โ
Automatically closed - issue fixed for 2 weeks with no activity.