I’m having an issue with resaving a matrix block on users from a front end form. The problem is that after resaving the block and the page reloading. The styling on the page breaks until reload. When opening the web console, a number of errors are returned that I’m pretty sure shouldn’t be in the front end:
I think I may have found the code in the craftcms vendor files that is causing this to happen. It is located in craftcms/cms/src/elements/MatrixBlock.php
Commenting out the following code seems to stop all of the errors and on reload the page is fine:
/**
* @inheritdoc
*/
public function afterDelete()
{
if (!Craft::$app->getRequest()->getIsConsoleRequest()) {
// Tell the browser to forget about this block
$session = Craft::$app->getSession();
$session->addAssetBundleFlash(MatrixAsset::class);
$session->addJsFlash('Craft.MatrixInput.forgetCollapsedBlockId('.$this->id.');');
}
parent::afterDelete();
}
Apart from this, I can’t seem to get any further into cracking the issue. Does anyone have any ideas? Thanks.