You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a page contains blocks but it's items key in the blocks_layout is empty, entering edit mode will cause a recursion error and cause the page to crash.
This is due to the check for invalid blocks within the BlocksForm component:
This state update during render is already a bad pattern as it causes unwanted side effects, but in this case it will re-render the Form component while the BlocksForm is still trying to render, causing an infinite render loop.
To Reproduce
Steps to reproduce the behavior:
Create a local frontend & backend
Create a new page and save it
View the classic UI/ backend edit view for the newly created page, open the "layout" tab and delete all strings from within the "items" JSON key in the Blocks Layout text field.
Save the page and view the frontend again
See that the frontend in view mode works fine (it will display nothing)
Try to open 'edit' mode
The page will either display a React max recursion error (Volto 16) or the tab/ browser will become unresponsive without any error.
Expected behavior
The page displays nothing
Software (please complete the following information):
OS: [e.g. iOS] All
Browser [e.g. firefox, chrome, safari] All
Volto Version [e.g. 18.4.0] 16.x - 18.8.4
Plone Version [e.g. 6.1.0] 6.0/ 6.1
Plone REST API Version [e.g. 9.1.0] N/A
Additional context
While this is a bit of an odd state to get in to, there are many ways it could happen (editors/ developers deleting the key, bad code rollout, addon misbehaving, etc.) and having the page silently crash and cause the user device to become unresponsive is highly undesirable.
The text was updated successfully, but these errors were encountered:
Looking into the infinite loop caused by onChangeFormData during render cycles in BlocksForm. Seems like moving the invalid block cleanup to a useEffect might stabilize the state updates.
Will try to fix it....
Describe the bug
If a page contains blocks but it's
items
key in the blocks_layout is empty, entering edit mode will cause a recursion error and cause the page to crash.This is due to the check for invalid blocks within the BlocksForm component:
volto/packages/volto/src/components/manage/Blocks/Block/BlocksForm.jsx
Lines 263 to 268 in 3330285
onChangeFormData
triggers a state update in the Form component:volto/packages/volto/src/components/manage/Form/Form.jsx
Lines 774 to 785 in 3330285
This state update during render is already a bad pattern as it causes unwanted side effects, but in this case it will re-render the Form component while the
BlocksForm
is still trying to render, causing an infinite render loop.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The page displays nothing
Software (please complete the following information):
Additional context
While this is a bit of an odd state to get in to, there are many ways it could happen (editors/ developers deleting the key, bad code rollout, addon misbehaving, etc.) and having the page silently crash and cause the user device to become unresponsive is highly undesirable.
The text was updated successfully, but these errors were encountered: