Router cannot refresh page if url has anchor #37090
Replies: 2 comments
-
This is more of a workaround that is better than your current method. (In my opinion of course) useSWR('/api/data', fetcher, { fallbackData: prefetchedData }) Where prefetched data would be the applicable props from getServerSideProps When you need to update it, you can just call mutate. It will also automatically re-fetch it on window focus after a few seconds (by default) Here's a link to client side rendering. |
Beta Was this translation helpful? Give feedback.
-
Issue still exists with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
I need to refresh current page with calling
getServerSideProps
, but without reloading whole page (router.reload
,window.location.reload
).Router has no special method for that, so I using:
But if current page url has
#anchor
, reload do not works.Describe the solution you'd like
Some option to "force" push/replace.
Describe alternatives you've considered
Current workaround is:
Beta Was this translation helpful? Give feedback.
All reactions