Skip to content

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

Open
@larrybotha

Description

@larrybotha

$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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions