Skip to content

Multiple repeaters 2.9.11 #11523

@pmallek

Description

@pmallek

In version 2.9.11 when i add multiple repeaters it causes some unexpected issues. When i rollback elementor to 2.9.8 everything works just fine.

`
$this->start_controls_section(
'mc_test',
[
'label' => esc_html__('Test', 'mycar-core'),
'tab' => Controls_Manager::TAB_CONTENT

        ]
    );

    $repeater = new Repeater();
    $repeater->add_control(
        'text',
        [
            'label' => esc_html__('Text', 'mycar-core'),
            'type' => Controls_Manager::TEXT
        ]
    );
    $this->add_control(
        'test_1',
        [
            'label' => esc_html__('Test 1', 'mycar-core'),
            'type' => Controls_Manager::REPEATER,
            'fields' => $repeater->get_controls()
        ]
    );

    $repeater = new Repeater();
    $repeater->add_control(
        'text',
        [
            'label' => esc_html__('Text', 'mycar-core'),
            'type' => Controls_Manager::TEXT
        ]
    );
    $this->add_control(
        'test_2',
        [
            'label' => esc_html__('Test 1', 'mycar-core'),
            'type' => Controls_Manager::REPEATER,
            'fields' => $repeater->get_controls()
        ]
    );

    $this->end_controls_section();

`

After first time i add this widget all repeater controls work just fine. However after i refresh elementor edit page and try to add new item to one of these repeaters it doesn't nothing and console throw errors:

common.min.js?ver=2.9.11:2 TypeError: Cannot read property 'id' of undefined
at i.get (editor.min.js?ver=2.9.11:2)
at initialize (editor.min.js?ver=2.9.11:2)
at initialize (editor.min.js?ver=2.9.11:2)
at i.h.View (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,underscore,shortcode,utils,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[chunk_1]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=5.4.1:16)
at i.constructor (backbone.marionette.min.js?ver=2.4.5:22)
at i.constructor (backbone.marionette.min.js?ver=2.4.5:22)
at i.constructor (backbone.marionette.min.js?ver=2.4.5:23)
at i [as constructor] (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,underscore,shortcode,utils,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[chunk_1]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=5.4.1:16)
at i [as constructor] (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,underscore,shortcode,utils,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[chunk_1]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=5.4.1:16)
at new i (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,underscore,shortcode,utils,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[chunk_1]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=5.4.1:16)
consoleError @ common.min.js?ver=2.9.11:2
backbone.marionette.min.js?ver=2.4.5:22 Uncaught TypeError: Cannot read property 'cid' of undefined
at c.findByModel (backbone.marionette.min.js?ver=2.4.5:22)
at i.onButtonAddRowClick (editor.min.js?ver=2.9.11:31)
at HTMLDivElement.dispatch (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,underscore,shortcode,utils,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[chunk_1]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=5.4.1:3)
at HTMLDivElement.r.handle (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,underscore,shortcode,utils,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[chunk_1]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=5.4.1:3)

Specific steps to reproduce:

  1. Add widget
  2. Add at least one item to repeater
  3. Save and refresh page
  4. Add another item to repeater
  5. no reaction and errors on console

Everything works just fine if there is just one repeater.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates a bug with one or multiple components.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions