Skip to content

Commit

Permalink
Gracefully handle enqueued assets which are deregistered late without…
Browse files Browse the repository at this point in the history
… being unenqueued. Fixes #147.
  • Loading branch information
johnbillion committed Feb 23, 2016
1 parent 9d5403e commit 14acf56
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion collectors/assets.php
Expand Up @@ -64,7 +64,7 @@ public function process() {
}
$raw = $this->data['raw'][ $type ];
$broken = array_values( array_diff( $raw->queue, $raw->done ) );
$missing = array();
$missing = array_values( array_diff( $raw->queue, array_keys( $raw->registered ) ) );

if ( !empty( $broken ) ) {
foreach ( $broken as $key => $handle ) {
Expand All @@ -85,6 +85,9 @@ public function process() {
$this->data['missing'][ $type ] = array_unique( $missing );
foreach ( $this->data['missing'][ $type ] as $handle ) {
$raw->add( $handle, false );
if ( false !== ( $key = array_search( $handle, $raw->done ) ) ) {
unset( $raw->done[ $key ] );
}
}
}

Expand Down

0 comments on commit 14acf56

Please sign in to comment.