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.

Nested routes and refresh problem

See original GitHub issue

Hi! 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
virtualdcommented, Oct 3, 2018

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

0reactions
GianlucaGuarinicommented, Oct 14, 2018

Fixed in riot-route@3.1.4 many thanks to @aadilhasan

Read more comments on GitHub >

github_iconTop 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 >

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