elements icon indicating copy to clipboard operation
elements copied to clipboard

Search component in Gatsby not `navigate`ing

Open bzmw opened this issue 4 years ago • 1 comments

Describe the bug

In my Search component I have a handleClick function that I'm trying to get to use Gatsby's internal navigation system so that when clicking in search I do not need to do a full page reload like in the example (window.location.href)

Right now I'm doing a pretty simple call to Gatsby's navigate function https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-link/

What happens is that the url updates but there is no visual change on the page.

I think there may be a different navigation api that y'all used in dev-portal that I may need to use instead.

To Reproduce

import { navigate } from 'gatsby';
handleClick() {
  navigate(`/docs/${data.slug}`, {state: {}, replace: true});
}

Expected behavior

User can navigate to search result without having to do a full page refresh.

Environment (remove any that are not applicable):

  • Elements: latest
  • Gatsby: ^3.4.0

bzmw avatar Oct 26 '21 18:10 bzmw

Are there any updates on this or some documentation on how to handle this?

alexandrudanpop avatar Jan 04 '24 15:01 alexandrudanpop