question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page doesn't update when navigating within the same route using different params

See original GitHub issue

If I have a route such as: 'blog/:id: Blog' and I navigate to blog/3, via a link/href from blog/2, the route doesn’t update. I have tried using traditional links as well as the imperative push and replace functions provided by this library.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
MerlinBcommented, Sep 21, 2022

To solve this you can force re-render the component inside of a parent component when the params change.

<script>
  import SomeComponent from "SomeComponent.svelte"

  export let params
</script>

{#key params.someParam}
  <SomeComponent someParam={params.someParam} /> // All code from the route moved into this component
{/key}
1reaction
algalycommented, Oct 20, 2022

Try replacing your a tag with button and use the push method. Worked for me! (even with animation)

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - data is not updating on page after routing to same url ...
In this way when you navigate to a new url, the code is execute again ... in that case just try to implement...
Read more >
Cannot navigate to same route with different params #2882
In react-navigation 3+ you should use navigation.push to navigate to the same route with different params, essentially forcing a 'rerender'.
Read more >
Navigate to a URL with Query Strings (Search Params) in ...
React Router has a useSearchParams hook to help us read or update the query string of a route that's active, but it doesn't...
Read more >
Angular: Refetch data on same URL navigation - Medium
URL params may be confusing when copied and send to another person. Value of refresh property does not match with the time we...
Read more >
Router tutorial: tour of heroes - Angular
The Crisis Detail appears in a child component on the same page, ... you can detect when the route parameters change from within...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found