- Issue created by @larowlan
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
This is very similar to the outline → I wrote on 🌱 [META] Production-ready ComponentSource plugins Active .
The key difference: I tried to do it generically, not restricted to SDCs & code components. So, for example, Block plugins may change (evolve) their settings and provide an update path, and so XB should be able to apply such an update path. Layout Builder hasn't solved this yet either — see the 🐛 Block plugins need to be able to update their settings in multiple different storage implementations Active core issue
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Specifically doing this for only the
sdc
andjs
component sources does not make that much sense to me yet. What problem does that solve? 🤔To avoid the need to look up in some central place what field type + storage settings + instance settings + widget should be used for a given SDC prop is … exactly why
StaticPropSource
s contain all that information, and why that is stored in theinputs
field property of the XB field type.And … I think that is what you're aiming to solve here: storing less data in
inputs
. Even though you omitted it from the issue summary: you only showed the before vs after for thetree
field property, not for theinputs
field property 😄 Updated issue summary based on this interpretation. But I'd like you to confirm it. 🙏 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Very closely related, and one of the oldest XB issues: 📌 [later phase] When the field type for a PropShape changes, the Content Creator must be able to upgrade Postponed .
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
From @larowlan's issue summary:
- Adding a new required prop - this is relevant if we go down the non JSON storage approach
- Removing a value from an enum
- Changing the mapped field type
- Removing a prop - although the net outcome here is redundant data in the database for old components - so we might not care here
I don't think I agree with stating these are things we have to support:
- This is sort of a BC break, except we could automatically fix this: detect the stored version not matching the current version, and add the missing default — both at render time and at edit time, which means after saving it'll have been automatically fixed.
- This is a BC break we cannot recover from: either we drop the user's choice (data loss) or the rendering crashes — which is exactly why 📌 Improve server-side error handling Active has explicit test coverage for this.
- This is what
hook_storage_prop_shape_alter()
allows and what #5 is about. And it's what allows the storage efficiency improvement described in #4. - Equivalent to point 1, except that here too there would be data loss — especially if a future revision of the SDC restores this. Note that redundant data (aka prop sources for non-existent props) will not be accepted by
\Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase::validateComponentInput()
.
So: what is your purpose with this issue, @larowlan? Storage efficiency, input schema evolvability, both, or something else still?