Skip to content

Commit

Permalink
Make prefetch not async (#48897)
Browse files Browse the repository at this point in the history
The prefetch method is currently an async method but there's nothing to await. It's updated out-of-band. It shouldn't return a Promise.

I also found a console.log that looked out of place.
  • Loading branch information
sebmarkbage committed Apr 27, 2023
1 parent 98e0c4a commit f4a01b4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion packages/next/src/client/components/app-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function Router({
const routerInstance: AppRouterInstance = {
back: () => window.history.back(),
forward: () => window.history.forward(),
prefetch: async (href, options) => {
prefetch: (href, options) => {
// If prefetch has already been triggered, don't trigger it again.
if (isBot(window.navigator.userAgent)) {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function prefetchReducer(
* where we didn't have the prefetch intent. We want to update it to the new, more accurate, kind here.
*/
if (cacheEntry.kind === PrefetchKind.TEMPORARY) {
console.log(href, action.kind, cacheEntry)
state.prefetchCache.set(href, {
...cacheEntry,
kind: action.kind,
Expand Down

0 comments on commit f4a01b4

Please sign in to comment.