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

[Content]: <Router> - root and Suspense are required with file-based routing #795

Open
klequis opened this issue Jun 26, 2024 · 1 comment
Labels
help wanted Looking for assistance on this issue improve documentation Enhance existing documentation.

Comments

@klequis
Copy link
Contributor

klequis commented Jun 26, 2024

📚 Subject area/topic

SolidStart > Routing

📋 Page(s) affected (or suggested, for new content)

https://docs.solidjs.com/solid-start/building-your-application/routing

📋 Description of content that is out-of-date or incorrect

In a SolidStart project using <FileRoutes>, <Router> requires both

  • A component as the value of its root prop.
  • {props.children} must be wrapped in <Suspense>

See discussion that starts here: https://discord.com/channels/722131463138705510/861229287868858379/1255593230150402078

If there is agreement that these two points need to be made in the doc, I'll create a PR.

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

@klequis klequis added improve documentation Enhance existing documentation. pending review Awaiting review by team members. labels Jun 26, 2024
@klequis
Copy link
Contributor Author

klequis commented Jul 1, 2024

Additional confirmation that Suspense is required

Question
Why am I getting a hydration error?

Answer
You forgot to wrap your routes with suspense

Why
Because inside FileRoutes there's a hidden mechanism of lazy loading your pages. That's why you need a suspense to make it work properly.

@LadyBluenotes LadyBluenotes removed their assignment Jul 18, 2024
@LadyBluenotes LadyBluenotes added help wanted Looking for assistance on this issue and removed pending review Awaiting review by team members. labels Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Looking for assistance on this issue improve documentation Enhance existing documentation.
Projects
None yet
Development

No branches or pull requests

2 participants