1

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:

Imgur: web console errors

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.

  • I have exactly the same problem. Using Matrix within SuperTable. – r-ninja Apr 19 '18 at 15:30
  • This should now be fixed thanks to this fix in 3.0.4 – Harry Harrison Apr 24 '18 at 20:28