AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
823 stars 168 forks source link

ACF 6.3.0 update breaks "No fields assigned" filter with empty string #910

Closed cabrailsford closed 4 weeks ago

cabrailsford commented 1 month ago

Describe the bug When updating to 6.3.0, I selected an existing ACF block that has no fields assigned to it. I am using the no_fields_assigned_message filter to return an empty string, which simply output nothing below the title & description before the update. Now it shows a constant spinner, and an error in the console of Cannot read properties of undefined (reading 'data').

To Reproduce Steps to reproduce the behavior:

  1. Assign add_filter( 'acf/blocks/no_fields_assigned_message', '__return_empty_string' ); in theme/plugin.
  2. Go to any post or page with an ACF block that has no fields.
  3. Click on the block to select it.
  4. Check the block sidebar under the title.
  5. See the spinner.
  6. Open the web inspector console.
  7. See error.

Expected behavior Using the acf/blocks/no_fields_assigned_message filter with __return_empty_string should not show anything under the block title/description, nor produce errors in the console.

Screenshots or Video Here is a video showcasing 2 identical blocks, one of which has a custom field assigned to it, while the other does not.

Code block.json

render.php

/**
 * ACF Test Block 2
 *
 * @package ACFTest
 **/

echo '<div>This is a test block 2</div>';

functions.php

add_filter( 'acf/blocks/no_fields_assigned_message', '__return_empty_string' );

Version Information:

cabrailsford commented 4 weeks ago

@lgladdy @polevaultweb Following up on this, it appears the changes you pushed for 6.3.1 resolved the issue above.

The only request I have now is if it would be feasible to remove the padding and border applied to the empty fields section, as shown in this screenshot. Happy to close this ticket and open a new one if that works better. Thanks!

lgladdy commented 4 weeks ago

Hey @cabrailsford,

Turns out, we had to ship a 6.3.1.2 tonight for a fatal bug with blocks on widgets, so I was able to slip this fix in there too.

Can you confirm that's good for you now?

cabrailsford commented 4 weeks ago

@lgladdy That seems to have done the trick! Thanks for all the hard work, it's greatly appreciated!