Improve handling of delayed strategies when dependency aliases (bundles) are involved#80
Conversation
| if ( $this->registered[ $dep ]->src ) { | ||
| $flattened[] = $dep; | ||
| } elseif ( $this->registered[ $dep ]->deps ) { | ||
| array_push( $flattened, ...$this->get_unaliased_deps( $this->registered[ $dep ]->deps ) ); |
There was a problem hiding this comment.
Makes me so happy that the ... operator is supported in PHP 5.6+.
There was a problem hiding this comment.
Ya, this is great. Worth noting - for reference sake - that implementation of the spread operator differs from 5.6 - 7.x in the sense that 5.6 only supports argument unpacking, but not within array expressions. Thankfully, that is all that's needed here :)
…ere is a defer dependency
joemcgill
left a comment
There was a problem hiding this comment.
This looks good, but I'm seeing one of the test cases fail when I run them locally:
Tests_Dependencies_Scripts::test_various_strategy_dependency_chains with data set "async-alias-members-with-defer-dependency" is failing, due to the expectation that the delayed inline script loader script will be included in the expected markup, but it is not.
|
@joemcgill thanks for that. Strange I didn't notice before. On it... This commit broke it: 4af0d23 |
|
@joemcgill Fixed in 9cb97ab! I blame myself for copy-pasting from the |
joemcgill
left a comment
There was a problem hiding this comment.
Oh, the test was wrong and the delayed inline script loader really shouldn't have been printed. Neat!
5a14464
into
feature/enhance-wp-scripts-api-with-a-loading-strategy
Fixes #76
Also addresses WordPress#4391 (comment)
Amends WordPress#4391