Support

Account

Home Forums Bug Reports 5.7.0-beta4 applyFilters() JS bug

Solved

5.7.0-beta4 applyFilters() JS bug

  • I am seeing what I believe to be a bug in the new 5.7.0 beta4.

    When using the acf.add_filter() function to filter a value, even though my filter returns the value properly, an ‘undefined’ value is what makes its way back to the ACF JS.

    Here is an example of the filter used in my FontAwesome addon:

    // Add our classes to FontAwesome select2 fields
    acf.add_filter( 'select2_args', function( args, $select, settings, $field ) {
    
    	if ( $select.hasClass('select2-fontawesome') ) {
    		args.dropdownCssClass = 'fa-select2-drop';
    		args.containerCssClass = 'fa-select2';
    	}
    
    	return args;
    });

    Console logging the select2_args value before/after acf.applyFilters() is called in acf-input.js shows that after the filter is run, the value becomes undefined.

  • Hi @mkeys

    Thanks for the bug report.

    We just found this bug too in some recent testing and have fixed the issue.
    It was a missing ‘return’ statement in the add_filter() compatibility layer.

    Nice work debugging the issue, you were spot on!
    I would like to send you updated JS files. Can you please replace these in the ‘assets/js’ folder and then hard refresh your page.

    Let me know if this fixes the issue.

    Thanks
    Elliot

  • Thanks Elliot, I can confirm that with these new JS files, the issue is resolved.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.