Skip to content

Conversation

@dpanta94
Copy link
Member

Adds a check in the enqueue method to prevent any asset enqueueing
when an empty array is explicitly passed. This ensures the method
behaves as expected in such scenarios.

Also adds a test to verify that no assets are enqueued when a
non-existent group is requested via enqueue_group.

Adds a check in the `enqueue` method to prevent any asset enqueueing
when an empty array is explicitly passed. This ensures the method
behaves as expected in such scenarios.

Also adds a test to verify that no assets are enqueued when a
non-existent group is requested via `enqueue_group`.
@dpanta94 dpanta94 self-assigned this Aug 26, 2025
@dpanta94 dpanta94 requested review from bordoni and borkweb August 26, 2025 16:01
@dpanta94 dpanta94 added the bug Something isn't working label Aug 26, 2025
@dpanta94 dpanta94 requested a review from Camwyn August 26, 2025 16:03
* @since 1.4.11 - If explicitly passed an empty array, enqueue nothing.
*/
public function enqueue( $assets_to_enqueue = null, bool $should_enqueue_no_matter_what = false ) {
// If explicitly passed an empty array, enqueue nothing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the expected behavior is if $assets_to_enqueue is empty (null - not an array) we should enqueue everything?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that keeps the library backwards compatible

@dpanta94 dpanta94 merged commit 696c873 into main Aug 26, 2025
3 checks passed
@dpanta94 dpanta94 deleted the fix/empty-category-enqueue branch August 26, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants