- Issue created by @mayur-sose
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
See https://git.drupalcode.org/project/experience_builder/-/blob/0.x/compone... โ
heading
is required. So then the "failed to render" message is normal.This seems like another case where deleting the required value should restore the original example.
But โฆ we discussed this 2 days ago, and didn't we agree that we'd go for exactly this behavior everywhere, as a way to convey: "dear user, you removed a required input, so of course it cannot render" โ where that is shown to the user in:
- client-side validation in the component instance form
- the preview (which you're reporting here)
- the "Publish all changes" button will report this same validation error
So โฆ what's the bug? ๐ค
Would like Ben's assessment on this โ do you agree, Ben?
After removing the heading from the hero component, a frontend validation error is correctly displayed. However, if the user switches tabs and attempts to edit another field, the component fails to render. This could be improved from a user experience perspective.
Ideally, the component should not fail to render when a required field is left blank. Instead, the error should be shown when the user tries to publish changes with an empty heading field.
In my view, adding validation for required fields during publishing is one issue, while the component failing when text is removed from a required field is a separate concern and which is not a good user experience.- ๐บ๐ธUnited States bnjmnm Ann Arbor, MI
Ideally, the component should not fail to render when a required field is left blank.
I disagree, if a component has an invalid prop, it shouldn't be rendering. That said, the. component should do a better job informing the user why it isn't rendering, which we will address here:
๐ Invalid prop errors should be detailed in Component preview Active
- ๐ซ๐ฎFinland lauriii Finland
I don't think the current UX is acceptable; invalid form value should not result in the component rendering an error.
I'm wondering why are we throwing an error instead of rendering the component with the empty string? JSON Schema required allows empty string so the component itself should be able to render with that.
Even though JSON Schema allows that, we could enforce a stronger validation and show it as a validation error on the form / review changes panel, but that could be separate from the rendering part.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
@lauriii we discussed this at length with a big group while you were on PTO. ๐ Invalid prop errors should be detailed in Component preview Active is what @effulgentsia, @bnjmnm, myself and others arrived at.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Please merge in
0.x
before doing more work, because โจ Add a Video prop type to the Code Component editor Active landed a few hours ago, and made significant changes in this area โ enough to also fix ๐ Default image is not loaded when adding a pattern Active .This issue is about something else though: it's not about
DefaultRelativeUrlPropSource
s at all, but it's still touching the same code, so merging in upstream now will prevent a very painful conflict later on. Plus, the clean-up that #3534601 did just might end up helping you here! ๐ - ๐บ๐ธUnited States bnjmnm Ann Arbor, MI
Switching to needs review, but specifically a back end person should look at my MR + Code comments to make sure the things I'm removing are OK to remove. All the BE changes needed to get this working required removing stuff that I assume was added for a good reason, but since the tests pass maybe it's fine? LMK!
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
HEAD
When following the steps to reproduce, the client sends this to the server:
{ "source": { "subheading": { "expression": "โน๏ธstringโvalue", "sourceType": "static:field_item:string", "value": "" }, "cta1": { "expression": "โน๏ธstringโvalue", "sourceType": "static:field_item:string", "value": "View" }, "cta1href": { "expression": "โน๏ธlinkโurl", "sourceType": "static:field_item:link", "value": "https://example.com", "sourceTypeSettings": { "instance": { "title": 0 } } }, "cta2": { "expression": "โน๏ธstringโvalue", "sourceType": "static:field_item:string", "value": "Click" }, "heading": { "required": true, "jsonSchema": { "type": "string" }, "sourceType": "static:field_item:string", "expression": "โน๏ธstringโvalue", "default_values": { "source": [ { "value": "There+goes+my+hero" } ], "resolved": "There+goes+my+hero" } } }, "resolved": { "subheading": "", "cta1": "View", "cta1href": "https://example.com", "cta2": "Click" } }
(note no key-value pair for
heading
underresolved
!) - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
MR
This changes the above by ensuring that
heading
is present, and with a fallback value of""
๐I reviewed the server-side changes, and responded on the MR with 3 concerns, and matched those with 3 commits to address those concerns.
Here's hoping @bnjmnm finds my concerns, commits and rationales convincing! ๐ค๐
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Major usability impact, so marking .
- ๐บ๐ธUnited States bnjmnm Ann Arbor, MI
This has been pretty thoroughly FE / BE reviewed but still needs MR approval for
Redux-integrated field widgets /ui/src/components/form/inputBehaviors.tsx
- ๐บ๐ธUnited States effulgentsia
I haven't reviewed the whole MR, since others have, but the
inputBehaviors.tsx
change looks correct, so I approved it since that was the only file not covered by other code owner approvals. - First commit to issue fork.
-
balintbrews โ
committed b5b83121 on 0.x authored by
bnjmnm โ
Issue #3529788 by bnjmnm, wim leers, mayur-sose, effulgentsia, lauriii:...
-
balintbrews โ
committed b5b83121 on 0.x authored by
bnjmnm โ