Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Link prefetch='mount'> not firing on mount #165

Closed
tony opened this issue Jan 4, 2020 · 0 comments
Closed

<Link prefetch='mount'> not firing on mount #165

tony opened this issue Jan 4, 2020 · 0 comments

Comments

@tony
Copy link
Contributor

tony commented Jan 4, 2020

We revised prefetch: true to be prefetch: 'mount", but kept the comparison to === true in the useEffect. I believe this makes the mount behavior only fire when true is passed, but that can never happen since === true is changed to 'mount' in the deprecation conditional:

if (prefetch === true) {
prefetch = 'mount'
if (process.env.NODE_ENV !== 'production') {
console.warn(
`Warning: A <Link> component received a "prefetch" value of "true". `
`This value is no longer supported - please set it to "mount" instead.`,
)
}
}
// Prefetch on hover by default.
if (prefetch === undefined) {
prefetch = 'hover'
}

Where mount prefetch happens:

React.useEffect(() => {
if (prefetch === true) {
doPrefetch()
}
}, [prefetch, doPrefetch])

jamesknelson added a commit that referenced this issue Jan 5, 2020
Fix prefetching on mount (fixes #165)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant