Problem/Motivation

The front-end app crashes when I open the component list. See this gif for reference:

Proposed resolution

We should probably do two things:

  1. Fix the bug causing this error
  2. Improve our error handling so that in case of an error, the whole app doesn't crash and lead into a white page
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lauriii created an issue. See original summary.

larowlan’s picture

3) add tests 😄

finnsky’s picture

Gonna check it ;)

finnsky’s picture

Not reproduced on my side.

lauriii’s picture

Status: Active » Closed (cannot reproduce)

I can't reproduce this with the latest HEAD. Closing for now.

gauravvvv’s picture

This is happening on preview only. If we use the command npm run preview for preview then front-end app crashes when I open the component list.

gauravvvv’s picture

Assigned: Unassigned » gauravvvv
Status: Closed (cannot reproduce) » Active
StatusFileSize
new2.87 MB

I have taken the latest pull on 0.x branch and on running the npm run start I am still facing this issue.

gauravvvv’s picture

Assigned: gauravvvv » Unassigned
Status: Active » Needs review
wim leers’s picture

Title: Front-end crashes when opening the components list » Mock fixtures missing `field_data`
Status: Needs review » Needs work
Issue tags: +DX (Developer Experience)
Related issues: +#3461435: End-to-end test that tests both the client (UI) and server, +#3450308: Create an Open API spec for the current mock HTTP responses, +#3452512: Add component instance edit form to contextual panel

WRT tests: #3461435: End-to-end test that tests both the client (UI) and server landed!

I see that #6 is saying this is only happening when not using the Drupal back-end, but when using the mocks. But #3461435 is testing client+Drupal server, not client+mock server.

So … #3461435 doesn't help. But #3450308: Create an Open API spec for the current mock HTTP responses would have caught this … because the mocks do not include field_data, and the UI code expects it to. Previously, the back end was behind the mocks, now (since #3452512: Add component instance edit form to contextual panel) the mocks are behind the back end. We'll keep having this game of chasing each other until #3450308 lands.

That makes me fairly confident in stating that the current MR is only fixing the symptom, not the root cause. AFAICT this should instead be updating /ui/mocks/fixtures.

anand.toshniwal93’s picture

StatusFileSize
new481.87 KB

Am just started with experience builder so I might be wrong
I started looking into above mentioned issue and below are my findings

1. The above issue is caused due to incorrect fixture.
2. It's failing because layout fixture does not consist `type` property.
due to which keyedLayout is always empty.

Object.values(layout.children).map(item => {
    if (item.type && components[item.type]) {
      keyedLayout[item.uuid] = item
    }
    return true;
  })

3. Component fixture is not matching with endpoint response from `/xb-compnents`
const selectedComponentType = keyedLayout[selectedComponent].type || 'noop';
the above always results in null as keyedLayout is empty.

updating component fixture and layout fixture in below format resolve issue however if you click on nested components "slots" it throws an same error because they are not added to keyedLayout.
Component fixture

{
  "component_1": {
    "name": "Component 1",
    "id": "1"
  },

Layout fixture:

{
        "uuid": "43cd7aa4-0160-4787-a3af-baf44ff17a88",
        "children": [],
        "type": "component_1",
        "nodeType": "component"
      },

wim leers’s picture

wim leers’s picture