-
Notifications
You must be signed in to change notification settings - Fork 161
Description
When a block layout flags an error, the site page form correctly becomes invalid. The resulting page flashes the error message, as expected, but it also discards blocks under some conditions.
To reproduce, add an error to, say, the HTML block's Html::onHydrate():
$errorStore->addError('element_name', 'invalid block');
Then, on a new site page, add an HTML block and any number of other blocks, and save the form. The form shows the error, but all new blocks are discarded, including the HTML block. The expected behavior is to keep the new blocks.
Even more confusing and concerning is the behavior when there are existing blocks. Add any number of other blocks and save the form. Then, add a HTML block to the end and save the form. The other blocks remain, as expected. Now, add a HTML block and move it to the top and save the form. The HTML block remains, but the last block is discarded. The expected behavior is to not discard the last block.
This behavior only happens when a block adds an error during hydrate. We likely haven't seen this before because, as far as I know, no block layout validates the data.