Bug: 'mb-conditional-logic' missing 'rwmb' dependency

Support MB Conditional Logic Bug: 'mb-conditional-logic' missing 'rwmb' dependency

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #50106
    Jayron CastroJayron Castro
    Participant

    Hi Meta Box team,

    I am reporting a minor enqueueing bug that is triggering a "_doing_it_wrong" notice in Query Monitor on the backend.

    The Scenario:
    When opening a standard page/post for editing in the backend (e.g., /wp-admin/post.php?post=1022&action=edit), Query Monitor flags a red PHP notice:

    "WP_Scripts::add was called incorrectly. The script with the handle 'mb-conditional-logic' was enqueued with dependencies that are not registered: rwmb."

    Visual Evidence:
    Here are the screenshots from Query Monitor illustrating the exact errors thrown:
    * Error 1 (Message): [https://ibb.co/v66msTsg](https://ibb.co/v66msTsg)
    * Error 2 (Dependencies): [https://ibb.co/dwFfHJBF](https://ibb.co/dwFfHJBF)

    The Technical Cause:
    It seems the Meta Box AIO (Conditional Logic module) is attempting to enqueue the 'mb-conditional-logic' script globally on the edit screen. However, on pages where there are no active meta boxes rendered, the core Meta Box script ('rwmb') is not enqueued/registered.

    Because 'mb-conditional-logic' declares 'rwmb' as a strict dependency, WordPress throws the dependency error. I have pasted the source JS code (conditional-logic.js) here for quick reference: [https://paste.jaded.net/p/trite.glossy.goldfinch.122b17](https://paste.jaded.net/p/trite.glossy.goldfinch.122b17)

    As you can see, the code wraps with '( function( $, rwmb )', which also causes a JS console error if rwmb is undefined.

    Suggested Fix:
    Could you add a conditional check in the PHP enqueue function of the Conditional Logic module to verify if 'rwmb' is actually registered/enqueued before attempting to load the conditional logic script? Something like 'wp_script_is( "rwmb", "registered" )'.

    It doesn't break the frontend, but fixing this will keep our Query Monitor logs clean.

    Best regards,

    Jayron Castro
    CEO, Kstros.com

    #50107
    PeterPeter
    Moderator

    Hello Jayron,

    Thank you for your feedback.

    I'm not able to reproduce the issue with clear steps on my demo site. However, I'm going to escalate the issue to the development team to check it further. IMO, using the function wp_script_is to check the deps is a good idea.

    #50108
    Jayron CastroJayron Castro
    Participant

    Hi team,

    Thank you for the quick follow-up and for escalating the issue!

    Since this specific notice only triggers under certain conditions (like an edit screen without any active meta boxes rendered), I understand it can be tricky to reproduce on a fresh demo site.

    To help the development team see exactly what is happening, I went ahead and recorded a quick screencast showing the exact steps and the Query Monitor output.

    You can watch the video here: [https://go.screenpal.com/watch/cOi2bCnUAis](https://go.screenpal.com/watch/cOi2bCnUAis)

    I hope this visual context helps the engineers easily track down the missing dependency. Let me know if they need any further testing or information from my staging environment!

    Best regards,

    Jayron Castro

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.