Skip to content

Commit

Permalink
fix: prefix navigate calls with pathPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
DSchau committed Sep 18, 2018
1 parent 0b719a1 commit b7e8e5a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/gatsby-link/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class GatsbyLink extends React.Component {
e.preventDefault()
// Is this link pointing to a hash on the same page? If so,
// just scroll there.
const { pathname, hash } = parsePath(prefixedTo)
const { pathname, hash } = parsePath(to)
if (pathname === location.pathname || !pathname) {
const element = hash
? document.getElementById(hash.substr(1))
Expand All @@ -154,7 +154,7 @@ class GatsbyLink extends React.Component {

// Make sure the necessary scripts and data are
// loaded before continuing.
navigate(prefixedTo, { state, replace })
navigate(to, { state, replace })
}

return true
Expand Down Expand Up @@ -183,21 +183,21 @@ const withLocation = Comp => props => (
export default withLocation(GatsbyLink)

export const navigate = (to, options) => {
window.___navigate(to, options)
window.___navigate(withPrefix(to), options)
}

export const push = to => {
console.warn(
`The "push" method is now deprecated and will be removed in Gatsby v3. Please use "navigate" instead.`
)
window.___push(to)
window.___push(withPrefix(to))
}

export const replace = to => {
console.warn(
`The "replace" method is now deprecated and will be removed in Gatsby v3. Please use "navigate" instead.`
)
window.___replace(to)
window.___replace(withPrefix(to))
}

// TODO: Remove navigateTo for Gatsby v3
Expand Down

0 comments on commit b7e8e5a

Please sign in to comment.