Overview

When a server-side error occurs during rendering the content preview, there is no way to recover from it other than deleting tempstore, which can mean data loss. This usually happens when adding a problematic component to a page. E.g.: #3502371: Make "Page title block" work A) also outside regions, B) on the only routes XB currently supports: content entity routes.

Proposed resolution

The error is caught by an error boundary where we can define a callback to attempt a reset in order to recover from the error. Currently we rely on the default behavior which will re-render the React component tree. This won't help if the error keeps occurring with the layout and model already saved server-side. What we can do instead is dispatching an undo action, which will remove the last added component, or revert component input changes that may have broke rendering.

User interface changes

Change the label of the button on the error message to "Undo last action" from "Try again" to make it clear how the recovery will be attempted.

CommentFileSizeAuthor
#3 xb-recover-from-preview-errors.gif5.88 MBbalintbrews
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

balintbrews created an issue. See original summary.

balintbrews’s picture

Assigned: balintbrews » Unassigned
Status: Active » Needs review
StatusFileSize
new5.88 MB

Recovering from a preview error

wim leers’s picture

#3485878: Server-rendered component instances should NEVER result in a user-facing error, should fall back to a meaningful error instead (+ log) should make the original scenario impossible.

But … this sure seems like a nice extra layer of safety — robust error handling on both client and server seems reasonable.

Approved for that principle, but this really needs FE review from @jessebaker, and product-level sign-off from @lauriii.

jessebaker’s picture

This goes a long way to implementing the first bullet of the proposed resolution on #3509333: After an error it’s possible to get trapped in an unrecoverable error state

  • balintbrews committed 9e6c236b on 0.x
    Issue #3511888 by balintbrews, jessebaker, wim leers: Recover from...
balintbrews’s picture

Assigned: lauriii » Unassigned
Status: Needs review » Fixed
Issue tags: -Needs product manager review

I got +1 from @lauriii.

wim leers’s picture

Very nice! 🤘

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.