Skip to content

Live Preview Updates Not Working with Kirki Repeater Field #2547

@Risad212

Description

@Risad212

I'm facing an issue where live preview updates aren't working for a Kirki Repeater field. Despite using transport: 'postMessage' and implementing the necessary JavaScript, the live preview doesn't update without refreshing the page.

Steps to Reproduce:

Add a Repeater field with a text field (e.g., skill).

Use transport: 'postMessage' for live preview.

Implement JavaScript to update the live preview dynamically.

Observe that the live preview does not update and the page refreshes instead.

Example code

new \Kirki\Field\Repeater(
	[
		'settings'             => 'banner_designation',
		'label'                => __('Banner Designation', 'pedro'),
		'section'              => 'banner_section',
		'choices'              => ['limit' => 3],
		'priority'             => 10,
		'transport'            => 'postMessage',
		'fields'               => [
			'skill'            => [
				'type'         => 'text',
				'label'        => __('Designation', 'pedro'),
				'default'      => '',
				'js_vars' => [
        [
            'element'  => '.skill-ul', // The element you want to update
            'function' => 'html',          // Use the 'html' function to update content
        ]
    ]
			]
		]
	]
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions