exhibitionist-digital / ultra

Zero-Legacy Deno/React Suspense SSR Framework
https://ultrajs.dev
MIT License
2.99k stars 66 forks source link

chore: update react router to 6.6 #234

Closed b3nten closed 1 year ago

b3nten commented 1 year ago

This PR will update the RR example to v6.6.1, which implements features from Remix like route actions and loaders.

ahuigo commented 1 year ago

Your PR removes the old simple dynamic react router example.

Maybe make a new example like examples/with-react-router-remix is better.

b3nten commented 1 year ago

I'm assuming the latest release of React Router is the reccomended one to use, and multiple examples could start to get confusing.

ahuigo commented 1 year ago

Your commit is missing dynamic routing, which is a very important feature you shouldn't remove it.

b3nten commented 1 year ago

Good point, although as far as I know dynamic routing is still not supported on deno.deploy. Not sure if that's something we want to include if 1/2 main deployment targets are unsupported by the example.

Shouldn't be an issue adding dynamic routes either way.

deckchairlabs commented 1 year ago

We support dynamic import on Deno Deploy with the inlineServerDynamicImports option, so I don't see an issue with keeping some of the lazy loaded routes, makes it a more complete example as well.

ahuigo commented 1 year ago

@B3nten I try to https://github.com/ahuigo/ultra/commit/0905407e99f930ba8a45ccac1a1e7c8a20095937

I tried to add lazy dynamic routing, but I get this error: Uncaught Error: There was an error while hydrating this Suspense boundary. Switched to client rendering. when access http://localhost:8000/

b3nten commented 1 year ago

@B3nten I try to ahuigo@0905407

I tried to add lazy dynamic routing, but I get this error: Uncaught Error: There was an error while hydrating this Suspense boundary. Switched to client rendering. when access http://localhost:8000/

It appears that RR is injecting a script tag into the body element with the loader data. This is causing a hydration error, but I'm not sure if it's an issue with RR or with the implementation. Could be a limitation with streaming.

Probably best to wait for https://github.com/remix-run/react-router/issues/9825 so we can get some official guidance on this. I'm going off of some example repo's atm.