Skip to content

Commit

Permalink
Do not reject when timeout ends
Browse files Browse the repository at this point in the history
  • Loading branch information
DAreRodz committed Sep 19, 2023
1 parent b5d29bf commit 58cae72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/interactivity/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ export const navigate = async ( href, options = {} ) => {

// Create a promise that resolves when the specified timeout ends. The
// timeout value is 10 seconds by default.
const { timeout = 10000 } = options;
const timeoutPromise = new Promise( ( resolve ) =>
setTimeout( () => resolve( false ), timeout )
setTimeout( resolve, options.timeout ?? 10000 )
);

const page = await Promise.race( [ pages.get( url ), timeoutPromise ] );
Expand All @@ -110,6 +109,7 @@ export const navigate = async ( href, options = {} ) => {
);
} else {
window.location.assign( href );
await new Promise( () => {} );
}
};

Expand Down

0 comments on commit 58cae72

Please sign in to comment.