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 2 posts - 1 through 2 (of 2 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?

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