Nested routes and refresh problem
See original GitHub issueHi! I am having trouble with nested routes. My issue looks very similar to the #86
I’m using version 3.1.2.
When I refresh the page only the top most router handles the event, nested tag route handlers are not called.
Example:
<app>
<router>
<route path="path/foo"><inner-tag /></route>
</router>
</app>
<inner-tag>
<p>{ name }</p>
<script>
this.name = 'loading';
var r = route.create()
r('path/foo', changeName )
function changeName(){
self.update({
name: "Greg"
})
}
</script>
</inner-tag>
When using links, history or pasting url I can only see ‘loading’. However if I manually remove ‘o’ and press enter, and then add ‘o’ and press enter ‘changeName’ gets called.
Calling inside ‘inner-tag’
route.exec();
seems to solve the problem, but it feels that something wrong.
Bug or rtfm ?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top Results From Across the Web
React nested route fails to load on refresh - Stack Overflow
I have been having the problem that when I nest a <Route/> element inside a component that is already being rendered by a...
Read more >Nested routes are not working when URL is refreshed #65
I have above configuration, when I navigate to /auth/login it works. however when I refresh the page, history fallback lib is not rendering...
Read more >[Solved]-React nested route fails to load on refresh-Reactjs
I have been having the problem that when I nest a <Route/> element inside a component that is already being rendered by a...
Read more >The Guide to Nested Routes with React Router - ui.dev
In this comprehensive, up-to-date guide, you'll learn everything you need to know about creating nested routes with React Router.
Read more >Material UI tabs with Nested Routes - Refreshing page error
The issue is that when I refresh the page it shows the password tab content with the general tab content! as shown in...
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 FreeTop 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
Top GitHub Comments
This is still pretty lightly tested, but I reworked the tag routing stuff so that it works correctly recursively. You can also put multiple child routers on a tag, and they’ll all get triggered correctly. It’s very much a break from how the current router tags behave, but it seems to work pretty well and is more intuitive to me.
I don’t have much time to clean it up or PR it, but hopefully someone finds this useful:
https://gist.github.com/virtuald/ac2fabcc37aeb00ecfe7a94e29035c72
Fixed in riot-route@3.1.4 many thanks to @aadilhasan