Hero component failed to render after removing text

Created on 12 June 2025, about 1 month ago

Overview

Hero component failed to render after removing text from heading and sub-heading text fields.

Steps to reproduce:

  • Remove heading text, and sub heading text
  • Component will fail to render and error message will be shown : "Component failed to render, check logs for more details"

Proposed resolution

User interface changes

๐Ÿ› Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • 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:

    1. client-side validation in the component instance form
    2. the preview (which you're reporting here)
    3. 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.

  • Merge request !1305#3529788 let empty be empty all over places โ†’ (Merged) created by bnjmnm
  • Pipeline finished with Failed
    3 days ago
    Total: 5668s
    #549488
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bnjmnm Ann Arbor, MI
  • ๐Ÿ‡ง๐Ÿ‡ช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 DefaultRelativeUrlPropSources 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 ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • ๐Ÿ‡ง๐Ÿ‡ช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 under resolved!)

  • Pipeline finished with Failed
    2 days ago
    Total: 826s
    #550450
  • ๐Ÿ‡ง๐Ÿ‡ช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! ๐Ÿคž๐Ÿ˜Š

  • Pipeline finished with Failed
    2 days ago
    Total: 813s
    #550462
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Improve title accuracy.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Major usability impact, so marking .

  • Pipeline finished with Success
    1 day ago
    Total: 809s
    #551276
  • Pipeline finished with Success
    1 day ago
    Total: 1563s
    #551448
  • ๐Ÿ‡บ๐Ÿ‡ธ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 
    
  • Pipeline finished with Success
    1 day ago
    Total: 917s
    #551474
  • ๐Ÿ‡บ๐Ÿ‡ธ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.
  • Pipeline finished with Skipped
    1 day ago
    #551508
  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands balintbrews Amsterdam, NL
Production build 0.71.5 2024