Skip to content
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

Support Nested Routing and Manifests #15

Closed
ryansolid opened this issue Aug 6, 2021 · 4 comments
Closed

Support Nested Routing and Manifests #15

ryansolid opened this issue Aug 6, 2021 · 4 comments

Comments

@ryansolid
Copy link
Member

Solid App Router supports nested routing. They do so by naming a file the same name as the folder. In so it acts as the parent. I haven't added that yet.

In addition we need to make sure that manifest lookup for preload works as well.

@jceb
Copy link
Contributor

jceb commented Oct 15, 2021

To improve the status quo, this line https://github.com/solidjs/solid-start/blob/main/packages/start/components/Outlet.tsx#L22 could be extended to let temp = list.find(o => o._id !== '/' && o._id && id.startsWith(o._id));. This would make it possible to support this kind of file structure:

/account/registration.jsx
/account/registration/index.jsx
/account/registration/otherpage.jsx

That generates this route structure:

      <Routes>
        <Route path="/account/registration" element=..>
          <Route path="/" element=.. >
            <Route path="/" />
            <Route path="/otherpage" element=.. />
          </Route>
        </Route>
      </Routes>

Compared to the previous route structure that doesn't work at all:

      <Routes>
        <Route path="/account/registration" element=..>
          <Route path="/" element=.. >
            <Route path="/">
              <Route path="/otherpage" element=.. />
            </Route>
          </Route>
        </Route>
      </Routes>

jceb added a commit to jceb/solid-start that referenced this issue Oct 15, 2021
* Not optimal but makes nested routes possible
@ryansolid
Copy link
Member Author

ryansolid commented Oct 15, 2021

I think the route structure should be ideally:

<Routes>
  <Route path="/account/registration" element=..>
    <Route path="/" element=.. />
    <Route path="/otherpage" element=.. />
  </Route>
</Routes>

There is no need for an intermediate slash path.. technically in this example only the top route is the shared layout.

@jceb
Copy link
Contributor

jceb commented Oct 15, 2021

Oh yes, you're right. The patch produces exactly that route

@jceb
Copy link
Contributor

jceb commented Oct 15, 2021

Could you take a look at it and merge it to main/release it?

ryansolid pushed a commit that referenced this issue Oct 16, 2021
* Not optimal but makes nested routes possible
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

No branches or pull requests

2 participants