Skip to content

Commit

Permalink
fix: linting + test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattjoh committed Oct 27, 2022
1 parent fb2fd27 commit 9676498
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
25 changes: 13 additions & 12 deletions packages/next/client/link.tsx
Expand Up @@ -78,7 +78,7 @@ type InternalLinkProps = {
*/
locale?: string | false
/**
* Enable legacy link behaviour.
* Enable legacy link behavior.
* @defaultValue `false`
* @see https://github.com/vercel/next.js/commit/489e65ed98544e69b0afd7e0cfc3f9f6c2b803b7
*/
Expand Down Expand Up @@ -122,18 +122,21 @@ function prefetch(
return
}

// Resolve the locale from the router.
const locale = 'locale' in router ? router.locale : undefined
// We should only dedupe requests when experimental.optimisticClientCache is
// disabled.
if (!process.env.__NEXT_OPTIMISTIC_CLIENT_CACHE) {
const locale = 'locale' in router ? router.locale : undefined

const key = href + '%' + as + (locale ? '%' + locale : '')
const key = href + '%' + as + (locale ? '%' + locale : '')

// If we've already fetched the key, then don't prefetch it again!
if (prefetched.has(key)) {
return
}
// If we've already fetched the key, then don't prefetch it again!
if (prefetched.has(key)) {
return
}

// Mark this URL as prefetched.
prefetched.add(key)
// Mark this URL as prefetched.
prefetched.add(key)
}

// Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
Expand Down Expand Up @@ -568,7 +571,6 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkPropsReal>(
return
}

// Check for not prefetch disabled in page using appRouter
if (!prefetchEnabled && isAppRouter) {
return
}
Expand All @@ -592,7 +594,6 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkPropsReal>(
return
}

// Check for not prefetch disabled in page using appRouter
if (!prefetchEnabled && isAppRouter) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/shared/lib/loadable.d.ts
Expand Up @@ -9,7 +9,7 @@ declare namespace LoadableExport {
}
}

// eslint-disable-next-line no-redeclare
// eslint-disable-next-line @typescript-eslint/no-redeclare
declare const LoadableExport: LoadableExport.ILoadable

export = LoadableExport
3 changes: 1 addition & 2 deletions test/e2e/app-dir/app/components/router-hooks-fixtures.js
Expand Up @@ -4,8 +4,7 @@ import {
useRouter as useAppRouter,
useSearchParams,
} from 'next/navigation'
import { useState } from 'react'
import { useEffect } from 'react'
import { useState, useEffect } from 'react'

export const RouterHooksFixtures = () => {
const pagesRouter = usePagesRouter()
Expand Down

0 comments on commit 9676498

Please sign in to comment.