-
Notifications
You must be signed in to change notification settings - Fork 375
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
Redirect doesn't early exit component when loading from browser address bar #1457
Comments
This is by design to a certain degree. Our Async isn't blocking until where you read from the resource, not where you declare it. This avoids waterfalls that Next cannot. Similarly our resources don't throw and can be undefined. Again to be non-blocking. We are exploring space of doing blocking along the reactive graph rather than the components in Solid 2.0. But the short of this is Solid does not work like React and we need to work on our documentation. The error behavior inconsistency on SSR + Hydration vs navigation is interesting. I'm gathering doesn't cause the server to error for some reason and then it gets skipped during hydration. That is probably worth further examination. |
You can avoid the rendering part by not showing the component until the resource is ready. Add
|
Yeah this by design... reviewing this again I see that the log does happen, just in the browser, on navigation. The reason for the 3 logs is the way SSR works, it fetches (first log), renders the component (second log) and realizes it needs to suspend. Then on completion it renders the component again (realizes it needs to redirect). In the client it fetches and renders the component (logging the render) then the server receives the response and logs the fetching, and then it resolves without re-running the component as reactivity just continues where it left off. |
Duplicates
Latest version
Current behavior 😯
When redirecting inside async server function call, the rest of the component still continue to run inside the server.
routes/admin.tsx
Logs in server:
Expected behavior 🤔
Basically for redirecting to exit early in the component execution, like how NextJS 14 works.
NextJS 14
app/admin/page.tsx
Logs in server:
Steps to reproduce 🕹
Steps:
http://localhost:3000/admin
in browser address bar/about
Context 🔦
No response
Your environment 🌎
The text was updated successfully, but these errors were encountered: