fail to work with Next.js Client-side navigations ( next/router, next/link )
See original GitHub issueHi. I’m using search-ui
with my Next.js
project.
But I found that when I navigate away from the search page to another page using the Client-side navigations
, I cannot go back by using the browser “back” button (I’ve only tried chrome.)
It seems to be the only lib that support elastic-app-search. Is it correct?
How to replicate:
- Run this demo repo
- visit search page
localhost:3001/search
- click
go home page
at the top of sidebar - when home page complete rendering, click your browser
back
button like this:
Problematic result: The URL do change to localhost:3001/search?......
but page remains in home page.
I’m not sure this issue come from search-ui
, not from Next.js. I guess this issue has something relate to Smart URL
– which I want to understand more but couldn’t find much documents.
BTW I also tried
search-ui
withreact router
, they worked well with each other.
Any hint?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Routing: Linking and Navigating - Next.js beta docs
Learn how to use the Link Component, useRouter Hook, and navigate between routes in your Next.js application.
Read more >client side navigation using 'next/link' not working #618 - GitHub
In each page I am importing header.js and respective components for that page. Code inside header.js is following : import Link from 'next/link' ......
Read more >Client-Side Routing In Next.js - Smashing Magazine
Next.js has a file-based routing system in which each page automatically becomes a route based on its file name. This article will guide...
Read more >External link is not working in Next.js when you want to use ...
To add an external link to the Next.js Link component we should use ... use the next/link for external links, as it's only...
Read more >Dealing with links in Next.js - LogRocket Blog
I use Next as an example, but they can be applied to pretty much all routing libraries: Use a custom Link component; Have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We also have this issue. Our workaround:
trackUrlState
tofalse
(it actually fixes the issue, but if you want track URL state go to 2 and 3).onSearch
to push state to query (you can use https://github.com/elastic/search-ui/blob/cb774e2ab1e6831ff40523c62d76b57d4c71ed5f/packages/search-ui/src/URLManager.js or write your own)initialState
on the component mountHope this will help
@Yurii-Adamenko Nice workaround.