solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.13k stars 143 forks source link

0.10.3 does not load anything with error in console #324

Closed ryanzec closed 8 months ago

ryanzec commented 8 months ago

Describe the bug

Maybe I am doing something wrong but it seems like solidjs router is bugged when I upgrade to 0.10.x. I looked at the migration notes here : https://github.com/solidjs/solid-router#migrations-from-09x : and I removed the use of <Routes /> but it just complete breaks (nothing loads).

The error I get is: Screen Shot 2023-12-16 at 1 51 48 PM

Which references this line: https://github.com/ryanzec/train-ui/blob/419da7730acd83cd2dafdfdca53c256282293502/applications/sandbox/packages/components/application-frame/application-frame-navigation-item.tsx#L14

But it is in a <Router /> so I am just not sure if there is some other thing I need to do in this migration.

Your Example Website or App

https://github.com/ryanzec/train-ui/pull/1

Steps to Reproduce the Bug or Issue

  1. Checkout repo and branch solid-router-bug-maybe
  2. run npm install
  3. run npm run sandbox:dev
  4. go to http://localhost:6006 (see error in console at this point)

Expected behavior

The application to load

Platform

Additional context

No response

Brendan-csel commented 8 months ago

Yeah this might be a little awkward but the only thing that can be inside <Router> now is a list of <Route> (or something that provides the array of route configuration).

Any other components that you used to have inside <Router> (wrapping the routes) need to move inside the Router's root property.

See https://github.com/solidjs/solid-router#configure-your-routes

ryansolid commented 8 months ago

Yeah.. The <Router> is like the old <Routes> component is the best way I can describe it. The reason is so that we can control what gets rendered completely (on the server). This will enable things like Server Components and single flight mutations.

This is an API change that might not be as nice ergonomically but it is important.

ryanzec commented 8 months ago

Yea, I guess I missed the link in the migration notes that references that part of the documentation, sorry about that.

The only other things I got tripped up on was the fact that the component used as root for the <Router /> seems to not support having any custom properties but that was easy enough to refactor.

Thanks for the help.