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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | xb-recover-from-preview-errors.gif | 5.88 MB | balintbrews |
Issue fork experience_builder-3511888
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
Comment #3
balintbrewsComment #4
wim leers#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.
Comment #5
jessebaker commentedThis 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
Comment #6
jessebaker commentedComment #8
balintbrewsI got +1 from @lauriii.
Comment #9
wim leersVery nice! 🤘