wn-blocks-plugin icon indicating copy to clipboard operation
wn-blocks-plugin copied to clipboard

Blocks with block type fields sharing the same name cause out-of-memory issue

Open nmiyazaki-chapleau opened this issue 1 year ago • 3 comments

Adding a block with a block type field within itself and rendering it using renderBlocks() causes out-of-memory issues. More specifically, block variables are shared within each layer of blocks. This can happen at any level of depth within blocks. Example: We have Block 1 with a field "content" of type blocks and Block 2 with a field "content" of type blocks.

Inserting block 1 inside block 1 -> OOM issue. Inserting block 2 inside block 1 -> OOM issue.

Renaming Block 1's field "content" to "content_1":

Inserting block 1 inside block 1 -> OOM issue. Inserting block 2 inside block 1 -> OK.

I believe blocks shouldn't be able to access parent blocks' variables, as it would only lead to unintended consequences such as this one, and I do not see intentionally using parent variables in blocks as a good thing.

I believe this is a known issue, as the columns_two default block forcefully ignores itself as a valid block underneath.

nmiyazaki-chapleau avatar Jun 11 '24 13:06 nmiyazaki-chapleau

@bennothommo thoughts?

LukeTowers avatar Aug 01 '24 06:08 LukeTowers

@nmiyazaki-chapleau is this still an issue with latest dev-main branch ?

We fixed a few issues that might have caused this since you last reported this, namely https://github.com/wintercms/wn-blocks-plugin/pull/42 and https://github.com/wintercms/wn-blocks-plugin/pull/50

mjauvin avatar Feb 13 '25 05:02 mjauvin

Thanks, I'll take a look and test this out.

nmiyazaki-chapleau avatar Feb 13 '25 14:02 nmiyazaki-chapleau

Closing this for now, ping to have it reopened if this is still an issue.

LukeTowers avatar Jun 02 '25 03:06 LukeTowers