Skip to content

observableRow.getInputs() is no longer a function in custom repeater filter (breaking change since v3.6.0) #651

@od1

Description

@od1

Context

I'm using a custom Filter to render a repeater field as formatted HTML in a "summary" step of a multi-step form.

Bug

After updating to version 3.6.0, the following code throws:

TypeError: observableRow.getInputs is not a function

Reproduction

<script>
jQuery( () => {
    const { addFilter } = JetPlugins.hooks;
    const { Filter } = JetFormBuilderAbstract;

    function RepeaterFilter() {
        Filter.call( this );

        this.getSlug = function () {
            return 'repeaterTemplate';
        };

        this.apply = function ( value ) {
            const output = [];
            for ( const observableRow of value ) {
                // ❌ Throws: observableRow.getInputs is not a function
                for ( const input of observableRow.getInputs() ) {
                    output.push( `${ input.name }: ${ input.getValue() }` );
                }
            }
            return output.join( ', ' );
        };
    }
    RepeaterFilter.prototype = Object.create( Filter.prototype );

    addFilter(
        'jet.fb.filters',
        'minimal-repeater-filter',
        function ( filters ) {
            filters.push( RepeaterFilter );
            return filters;
        },
    );
} );
</script>

<!-- Usage in an HTML block -->
<!JFB_FIELD::my_repeater|repeaterTemplate>

Expected

getInputs() returns the inputs of the repeater row, as in previous versions.

Actual

Couldn't test on latest yet, rolled back to 3.5.6.3

Questions

  1. Is this an intentional API change?
  2. What is the new recommended way to iterate inputs of a repeater row from a custom Filter?
  3. Could this be documented in the migration notes?

Environment

  • JFB version: 3.6.0 and upward (broken) / 3.5.6.3 (working)
  • WP version: 6.9
  • Browser: Safari 18.4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions