-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Fix loading wc admin scripts on unrelated WP admin pages #57150
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
Fix loading wc admin scripts on unrelated WP admin pages #57150
Conversation
Updated the admin script enqueue logic to check if the current page is an admin or embed page before loading the deprecation scripts. This improves performance by preventing unnecessary script loading on non-relevant pages.
Testing GuidelinesHi @louwie17 @woocommerce/flux, Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me.
Confirmed wcsettings-deprecation is only loaded in WC admin pages.
* Fix admin script loading condition in WCAdminSharedSettings Updated the admin script enqueue logic to check if the current page is an admin or embed page before loading the deprecation scripts. This improves performance by preventing unnecessary script loading on non-relevant pages. * Add changelog
…57186) Fix loading wc admin scripts on unrelated WP admin pages (#57150) * Fix admin script loading condition in WCAdminSharedSettings Updated the admin script enqueue logic to check if the current page is an admin or embed page before loading the deprecation scripts. This improves performance by preventing unnecessary script loading on non-relevant pages. * Add changelog Co-authored-by: Chi-Hsuan Huang <[email protected]>
Submission Review Guidelines:
Changes proposed in this Pull Request:
WC 9.8 (PR: #55707) introduced a bug where the
settings-deprecationscript is loaded on all admin pages without any condition, so all its dependencies are also loaded.This PR adds a condition to check if the current page is an admin or embed page before loading deprecation scripts to ensure we only load the script on relevant pages.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
/woocommerce/assets/client/adminscripts not being loadedwcsettings-deprecation.jsis still being loaded correctlyTesting that has already taken place:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment