Skip to content

Commit

Permalink
Don't use Promise.withResolvers() in search block's view.js
Browse files Browse the repository at this point in the history
  • Loading branch information
michalczaplinski committed Dec 3, 2024
1 parent db9ceee commit 7b326ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/block-library/src/search/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ const { state, actions } = store(

// Debounce the search by 300ms to prevent multiple navigations.
supersedePreviousSearch?.();
const { promise, resolve, reject } = Promise.withResolvers();
let resolve, reject;
const promise = new Promise( ( res, rej ) => {
resolve = res;
reject = rej;
} );
const timeout = setTimeout( resolve, 300 );
supersedePreviousSearch = () => {
clearTimeout( timeout );
Expand Down

0 comments on commit 7b326ce

Please sign in to comment.