Overview

The generated link in the Publish error for a code component is incorrect. Clicking the link below will navigate to /editor/js_component/my_component which is a 403.

link

Steps to reproduce

1. Create a code component
2. Edit component by adding required prop without example.
3. Exit code editor and publish changes
4. On publish you will see "Prop "text" is required, but does not have example value".
5. Then click on error link, it will navigate you to a URL that doesn't exist in Canvas.
/editor/js_component/my_component
"An unexpected error has occurred while fetching the layout."
Error 403

Proposed resolution

Edit ReviewErrors.tsx to handle code components. The link should redirect the user to the code editor.

Maybe something like:
// code component error

  if (
            !componentId &&
            !error?.source?.pointer &&
            error?.meta?.entity_type === 'js_component'
          ) {
            componentId = String(error?.meta?.entity_id);
            errorPath = `/code-editor/component/${componentId}`;
          }

User interface changes

Comments

hooroomoo created an issue. See original summary.

hooroomoo’s picture

Title: Link from publishing code component error is incorrect » Link after publishing error for a code component is incorrect
hooroomoo’s picture

Title: Link after publishing error for a code component is incorrect » Link after publishing error for a code component is incorrect
Issue summary: View changes
StatusFileSize
new97.71 KB
hooroomoo’s picture

Title: Link after publishing error for a code component is incorrect » Link from publishing error for a code component is incorrect
nagwani’s picture

Issue tags: +triaged
wim leers’s picture

Component: … to be triaged » Theme builder
Issue tags: +JavaScript

Per the issue summary, this appears to be a bug in the UI, not in the internal HTTP API. So tagging JavaScript.