Overview
It’s possible to get trapped in an unrecoverable error state in the XB UI.
Adding modifying the layoutModel in such a way that the POST to /xb/api/layout/{entitytype}/{entityId} returns an error, we show a modal alert.
Clicking Try again and thus re-requesting the preview endpoint won’t fix it, the issue is server side.
Refreshing the page won’t fix it - the erroring layout/model is now autosaved which means that refreshing the page just brings it back.
If the user was able to press Undo and THEN re-request the preview endpoint they might get unstuck, but if they refresh the page, they would lose the undo history and become stuck again.
The user can’t access the preview UI/layers panel to remove the offending component themself because the alert is modal.
You can’t remove pending autosaves from the Publish/Review button (I don’t know if you will be able to do this in future?).
Proposed resolution
Obviously in an ideal world we'd fix the causes of the crash! But some ideas
- Add an undo call to the callback function the Try again button calls.
- Display the error in a non-modal way.
- If the POST to /xb/api/layout/{entitytype}/{entityId} doesn't successfully return preview markup due to an error, then don't create an auto-save so at least the user can reload the page.
Comments
Comment #2
jessebaker commented#3511888: Recover from server-side errors that may happen during rendering preview does a good chunk of work towards this
Comment #3
wim leersWhat about errors in (more complex) code components? Is that intended to be handled here, too? (Previously identified this in #3485878-15: Server-rendered component instances should NEVER result in a user-facing error, should fall back to a meaningful error instead (+ log), but perhaps this issue is a better place to discuss it.)
Comment #4
hooroomooComment #5
wim leers#3499960: Generate path alias dynamically when editing landed, which is how this actually was pretty easy to trigger until recently 😅
I know @balintbrews is working to add hardening in multiple places, and some have already landed. @balintbrews, do you think that this issue can be marked as a duplicate of some other? 🤞
Comment #6
effulgentsia commentedIt's possible this is already at a state that's good enough for beta, but in case it isn't I'm tagging this as a beta blocker to make sure we evaluate it before releasing a beta.
Comment #7
wim leersI do not currently know of any remaining way to get to such a state. @mayur-sose, do you know of one?
Comment #8
mayur-sose commented@wim-leers, below is the one :
Comment #9
wim leersAh, that's the detail that was missing! We've already got an explicit bug report for that: #3530590: Expand functional test coverage for ContentCreatorVisibleXbConfigEntityAccessControlHandler.
Thanks, much appreciated!
Keeping this around to double-check after #3530590 lands that this indeed can be closed.
Comment #10
wim leers@mayur-sose You wrote "below is the one" — does that mean it's the only way you were able to get trapped? 🤞
Comment #11
mayur-sose commentedI’m investigating whether there are any other situations where users can get trapped. I will update you if I find any.
Comment #12
wim leersGreat, thanks! 🙏 I hope you'll fail, for all our sakes 😜😄
Comment #13
penyaskitoI can reproduce #8 and has nothing to do with the other issue mentioned in #9.
See my amend to #8:
You will see the following error:
An unexpected error has occurred in a route. 404 Not Found
This happens even if I'm deleting something that is not what I'm seeing in the editor.
But surprisingly only happens if I have that component in the editor.
The difference is that if I create a new editor, my url is:
xb_page/1/code-editor/code/test.But if I edit a placed component code, my url is:
xb_page/1/code-editor/component/jjj(see component instead of code).
When I delete a component, even if it's not the one selected, i go from
xb/xb_page/1/editor/component/0b914052-f057-4a94-81db-bb64a09850e3toxb/xb_page/1/editor(removing thecomponent/{uuid}).I think we are trying to do the same here, but ending in
xb_page/1/code-editorwhich is a wrong url (you can just go directly in the browser and will see the same error Mayur indicated)Maybe there's something checking a regex
component/{whatever}without checking a) that whatever is a uuid or, b) that we are at/editor/component/{whatever}(ensuring no match with/code-editor/component/{whatever}Comment #14
penyaskitoPer #13, unpostponing.
Comment #15
wim leersRelated but more obscure way to get trapped: #3532618: [Needs design] After session times out, the XB UI is stuck.
Comment #16
lauriiiWe've made improvements to the error handling to avoid this from happening in more cases. Discussed with some of the XB folks that we will be opening issues for specific instances where this happens in case that we run into those in future.