- Issue created by @lauriii
- 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺
I'm not sure if I understood the steps to reproduce.
Tried:
- Add a component with a video, set the video, create a pattern from it, add the pattern, video renders when adding the pattern.
- Add a component with an image that use a placeholder.co image, create a pattern from it, add the pattern, image renders with the default image.
- Add a component with an image, set an image, create a pattern from it, add the pattern, image renders with the given image.However:
- Add two column component, with an image in each column, one set, the other using default.
- When trying to create pattern, I get a 422 "The property image is required." - 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺
(I'm always referring to SDCs, if that makes a difference)
- 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺
Confirmed with Lauri this happens only when the image is optional (still with SDC).
Apparently happens because the re-render after refresh doesn't render the optional image in some cases? Verified by:
- Add an "optional image" component (let's call this A). Image from A is visible.
- Create a pattern from A.
- Add the pattern to the canvas (let's call this component B). Image from A is visible. Image from B is NOT visible.
- Set an image at component B, selecting it in the layers view. Image from B is visible as expected, image from A disappears 🤯🤯
- 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺
Attached recording from Lauri.
- 🇫🇮Finland lauriii Finland
This can be reproduced by just adding an image component with optional image to the page, and refreshing the page.
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
I'm convinced this ties into the areas I'm currently reviewing for ✨ Add a Video prop type to the Code Component editor Active . Specifically
// Undo what ::clientModelToInput() did: restore the prop source of // valueless props. if ($model['source'][$prop_name]['sourceType'] === DefaultRelativeUrlPropSource::getSourceTypePrefix()) { $model['source'][$prop_name] = $this->getDefaultStaticPropSource($prop_name) ->withValue($model['source'][$prop_name]['value']) ->toArray(); }
in
\Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase::inputToClientModel()
, added in 🐛 Image upload breaks after optional image without an image gets published Active , andcatch (\OutOfRangeException | \OutOfBoundsException $e) { if (($violations === NULL || (\array_key_exists('value', $prop_source) && $prop_source['value'] === $default_source_value)) && !empty($prop_value)) { // Valueless prop, for the case where only a default is provided for // the preview or the initial state of the component inputs form, and // the content creator has not populated the StaticPropSource. // This typically happens when the Content Creator instantiates a // component with an optional image prop that has a default value, and // they then immediately save the result. // @see ::exampleValueRequiresEntity() // @see ::getClientSideInfo() $client_side_info = $this->getClientSideInfo($component); \assert(isset($client_side_info['propSources'][$prop]['jsonSchema'])); $source = new DefaultRelativeUrlPropSource( value: $prop_value, jsonSchema: $client_side_info['propSources'][$prop]['jsonSchema'], componentId: $component->id(), ); $props[$prop] = $source->toArray(); continue; }
in
\Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase::clientModelToInput()
's handling ofDefaultRelativeUrlPropSource
, added in 📌 Split model values into resolved and raw Active , refined in 🐛 Adding the Image component results in a state considered invalid Active and many subsequent issues, most recently in 📌 Improve the front-end DX of Active .We've introduced something incomplete & brittle early on. We've been paying the price.
- 🇺🇸United States Kristen Pol Santa Cruz, CA, USA
I don't see "examples" noted in this issue:
- Create a component that has an image with no default and examples and another property
- Drag the component into XB and the image shows up
- Change a property value on the component that's not the image
- The image disappears
Example using the new Drupal CMS Mercury theme:
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
My testing shows ✨ Add a Video prop type to the Code Component editor Active resolves this
Postponing on that, but we'll need to expand e2e test coverage here once that's in.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Will add tests on top of ✨ Add a Video prop type to the Code Component editor Active
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Pushed two commits, one is a squash of ✨ Add a Video prop type to the Code Component editor Active and the other is test coverage for this issue.
The test fails with ✨ Add a Video prop type to the Code Component editor Active (as expected) but passes with it 🎉
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
✨ Add a Video prop type to the Code Component editor Active is in — let's land this additional test coverage 👍
-
wim leers →
committed 7800cf8f on 0.x authored by
larowlan →
Issue #3535806 by larowlan, penyaskito, lauriii, wim leers, kristen pol...
-
wim leers →
committed 7800cf8f on 0.x authored by
larowlan →