Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pum-admin-bar Script Fails to Load #907

Closed
fluxism opened this issue Nov 25, 2020 · 6 comments
Closed

pum-admin-bar Script Fails to Load #907

fluxism opened this issue Nov 25, 2020 · 6 comments
Labels
Milestone

Comments

@fluxism
Copy link

fluxism commented Nov 25, 2020

Describe the bug

Admin scripts fail to enqueue on front end, breaking the admin bar button

Site information

Popup Maker version: 1.13.1

WordPress version: 5.5.3
PHP version: 7.4.1

Expected behavior

popup-make/assets/js/admin-bar.js should load as long as Disable Popups Admin Bar is disabled in settings.

Current behavior

admin-bar.js, using the handle 'pum-admin-bar' fails to load. Query Monitor states "dependency missing"

Steps to reproduce

  1. Enable Popup Maker
  2. Visit front end page

Errors

Additional context

Was able to fix by adding to includes/modules/admin-bar.php, line 23:
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_files' ) );

@danieliser
Copy link
Member

@fluxism can you confirm that the issue exists if you only have Popup Maker active? I haven't seen this recently and have been using the toolbar a lot for testing new features.

An easy way to test it is using the Health Check plugin's Troubleshooting mode on our plugin. If it doesn't occur then, I'd activate the other plugins in troubleshooting mode one by one till the issue re-appears.

Let us know.

@fpcorso fpcorso added this to the v1.15 milestone Dec 2, 2020
@fluxism
Copy link
Author

fluxism commented Dec 3, 2020

I confirmed. In Troubleshooting mode with only Popup Maker activated the issue still occurs.

@lkraav
Copy link

lkraav commented Dec 4, 2020

I also see this happening, for some reason QM states jquery dependency missing, although it's clearly there.

Maybe a timing issue, race condition of some sort?

It started somewhere at around 1.10 maybe or thereabouts.

@fpcorso
Copy link
Contributor

fpcorso commented Dec 28, 2020

@fluxism @lkraav @danieliser I was able to reproduce this. Interestingly, the hook for the admin bar comes after the hook for printing footer scripts apparently.
image

This is definitely too late to be enqueueing scripts and styles. As suggested by @fluxism, I have moved that method to the enqueue_files hook. Thanks for reporting this!

fpcorso added a commit that referenced this issue Dec 28, 2020
@fpcorso fpcorso closed this as completed Dec 28, 2020
@danieliser
Copy link
Member

@fpcorso nice catch. Strange it didn't cause issues the entire time unless core changed something about that ordering.

@lkraav
Copy link

lkraav commented Dec 28, 2020

Nice catch. Strange it didn't cause issues the entire time unless core changed something about that ordering.

Most weird thing is that same site, this misfire shows up only on some screens for us. Most of the time this issue doesn't occur, so doesn't seem to be a core thing. Haven't been able to figure out what the common denominator is.

@fpcorso fpcorso mentioned this issue Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants