Skip to content

Commit

Permalink
Add note to indicate why priority queue callbacks may be undefined (#…
Browse files Browse the repository at this point in the history
…28337)


Co-authored-by: Glen Davies <glen.davies@a8c.com>
  • Loading branch information
glendaviesnz and Glen Davies committed Feb 10, 2021
1 parent 748421d commit 4cec557
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/priority-queue/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export const createQueue = () => {
const callback = /** @type {WPPriorityQueueCallback} */ ( elementsMap.get(
nextElement
) );
// If errors with undefined callbacks are encountered double check that all of your useSelect calls
// have all dependecies set correctly in second parameter. Missing dependencies can cause unexpected
// loops and race conditions in the queue.
callback();
elementsMap.delete( nextElement );
} while ( hasTimeRemaining() );
Expand Down

0 comments on commit 4cec557

Please sign in to comment.