Skip to content

Routes not rendering in 2nd-level nested Router onwards #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
larrybotha opened this issue Jun 17, 2020 · 0 comments · May be fixed by #4
Open

Routes not rendering in 2nd-level nested Router onwards #3

larrybotha opened this issue Jun 17, 2020 · 0 comments · May be fixed by #4

Comments

@larrybotha
Copy link

$active in routes defined from a 2nd level of nested Router onwards is always undefined, resulting in Route's slot / component never rendering.

  <p>
    <a href="/">Home</a> |
    <a href="/nest-1">nest-1</a> |
    <a href="/nest-1/nest-2">nest-2</a> |
    <a href="/nest-1/nest-2/nest-3">nest-3</a>
  </p>

  <Router>
    <Route path="/">
      <div>home</div>
    </Route>

    <Route path="/nest-1/*">
      <div>nest-1</div>

      <Router>
        <Route path="/">nest-1 index</Route>

        <Route path="/nest-2/*">
          <div>nest-2</div>

          <Router>
			<!-- never renders -->
            <Route path="/">nest-2 index</Route>

			<!-- never renders -->
            <Route path="/nest-3/*">
              <div>nest-3</div>
            </Route>
          </Router>
        </Route>
      </Router>
    </Route>
  </Router>

(I'd post a codesandbox link, but Codesandbox has an issue with the mjs module exported by navaid)

In the above example the Route containing nest-2 index will always have $active === undefined.

This seems odd since each Router gets its own instance of navaid, and the first nested Router works without issue.

Am I misunderstanding how to define routes, or am I not understanding how navaid works?

@larrybotha larrybotha linked a pull request Jun 17, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant