1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

fix prefetching relative path (#1151)

This commit is contained in:
Naoyuki Kanezawa 2017-02-15 21:34:13 +09:00 committed by Tim Neutkens
parent db97fbffad
commit 38d236e2b3

View file

@ -82,7 +82,9 @@ export default class Link extends Component {
// Prefetch the JSON page if asked (only in the client)
if (prefetch) {
if (typeof window !== 'undefined') {
Router.prefetch(props.href)
const { pathname } = window.location
const href = resolve(pathname, props.href)
Router.prefetch(href)
}
}