• I have a custom ACF block called “Cards” with a button group field called “Media Type” that has “Icon” and “Image” options. If “Icon” is selected, the user can then select a Font Awesome Icon.

    I encounter the “This block has encountered an error and cannot be previewed.” message when there’s a Font Awesome icon selected but then decide to switch the “Media Type” field to “Image”.

    For example, if I clone the Cards block and then switch “Media Type” to “Image”, the error message happens. The error does not happen in reverse, if I have “Image” selected and switch to “Icon”.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter joshkern

    (@joshkern)

    This is the console error message: NotFoundError: Failed to execute ‘removeChild’ on ‘Node’: The node to be removed is not a child of this node.

    Plugin Author Matt Keys

    (@mattkeys)

    Does this error continue after saving/refreshing the post you are editing?

    Thread Starter joshkern

    (@joshkern)

    No, the error doesn’t continue after saving/refreshing the post.

    Plugin Author Matt Keys

    (@mattkeys)

    Well, I am able to reproduce the error you are seeing. I also see the error if you switch back and forth from preview to editing the block a couple times without duplicating the block.

    I don’t have any answers unfortunately and I’m not actually sure if the fix for this would be within my plugin, in WordPress, or in ACF. Using my field within a block isn’t actually something I ever added to this plugin. It is something that ACF made available to all field types and required no changes on my end. So my thinking is this bug probably needs to be fixed within ACF, but I am not certain.

    If I figure anything more out about it I’ll share here. Or release an update if it is something I can fix on my end.

    Thread Starter joshkern

    (@joshkern)

    Thank you for reviewing this issue so quickly!

    I submitted a support ticket with ACF and referenced this thread. Hopefully, it’s something they can fix.

    Thread Starter joshkern

    (@joshkern)

    I reached out to ACF, but they weren’t able to resolve it. Here was their final response:

    Based on our latest review and the simplified block code you’ve shared, the error appears to emanate from ACF Font Awesome rather than from ACF itself or the core WordPress block editor. The console error (NotFoundError: Failed to execute 'removeChild' on 'Node') suggests a JavaScript-related issue, likely triggered during the rendering or update cycle of the Font Awesome field in the editor view.

    Since the error persists even with minimal PHP in the block template and seems tied to the presence of the Font Awesome field, we recommend reaching out to the ACF Font Awesome plugin maintainers directly to investigate how the field is handled in the block editor context.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘This block has encountered an error and cannot be previewed.’ is closed to new replies.