MB Blocks regression: nested instances of the same block render issue

Support MB Blocks MB Blocks regression: nested instances of the same block render issue

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #49931
    Emiliano GarcíaEmiliano García
    Participant

    Plugin: Meta Box AIO (current version, with MBBlocks\Loader::prepare_render_callback_data).
    Last known working version: Meta Box AIO 1.23.1.
    Stack: WordPress + WooCommerce + WooCommerce Subscriptions, PHP 8.x.

    Bug:
    When several instances of the same custom MB block are nested inside other MB blocks (a layout structure like meta-box/section > meta-box/row > meta-box/column > meta-box/plan-tab, with 4 different plan-tab instances inside 4 different columns), all rendered plan-tab instances output the data of the FIRST one. The same block at the top level of the post content renders correctly. The bug only triggers when the block is wrapped inside <InnerBlocks /> of a parent MB block.

    Block setup (relevant):

    Blocks registered via add_filter('rwmb_meta_boxes', ...) with 'type' => 'block', fields, and 'render_template' => dirname(__FILE__) . '/template.php'.
    Templates read $attributes['data'] directly. Some also use mb_get_block_field(). Both return the wrong data in the nested case.
    Reproduction:

    Register section, row, column blocks whose templates output <InnerBlocks />.
    Register a child block (e.g. plan-tab) with several text fields.
    In a page, add: section > row > 4 × (column > plan-tab), each plan-tab with different field values.
    Frontend: all 4 plan-tabs display the data of the first.

    #49933
    PeterPeter
    Moderator

    Hello Emiliano,

    Thanks for reaching out.

    I've tried to reproduce the issue on my site but did not see that: many instances of an inner block inside a custom block, all of inner blocks are displayed properly.

    Can you please share the code that you use to register the custom fields, blocks, template files and let me know how to reproduce the issue?

    #49934
    Emiliano GarcíaEmiliano García
    Participant

    This is how I define the blocks and incorporate them into my theme; this happens on several pages with the same structure

    https://drive.google.com/drive/folders/1-3biFWKtBySQN0fib335e8JhaNMaxome?usp=sharing

    #49937
    PeterPeter
    Moderator

    Hello Emiliano,

    Thank you for sharing the blocks. I can see the issue with the following format:
    - Section
    -- Row > A custom inner block
    -- Row > A custom inner block
    -- Row > A custom inner block

    then 3 custom inner blocks display the same content in the frontend as the first inner block.

    I've escalated the issue to the development team to check and fix this. I will let you know when it's done.

    #49945
    Emiliano GarcíaEmiliano García
    Participant

    Thank you! I need to revert to version 3.5.0 to avoid this bug.

    #49953
    Emiliano GarcíaEmiliano García
    Participant

    Any news?

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.