fix: clean up v2 templates list#78
Conversation
| "with-solidbase", | ||
| "with-strict-csp", | ||
| "with-tailwindcss", | ||
| "with-tanstack-router", |
There was a problem hiding this comment.
i actually don't think the with-tanstack-router one works at the moment
There was a problem hiding this comment.
i actually don't think the
with-tanstack-routerone works at the moment
Thank you for the comment.
I tested the template and confirmed the issue as you mentioned (CSR works fine, but an error occurs on the SSR path).
Would it be better to only include fully functional templates here? I think this comes down to the Solid community's UX goals and philosophy, so I'd love to hear your thoughts.
I originally opened this PR to sync the template list between the v2 templates list and this Repository.
What would be the best way forward?
Personally, if removing this line is the recommended approach, I think closing this PR and opening a fresh one might be healthier for context hygiene (especially considering future AI workflow).
So, I think we can choose two options:
- Comment out or remove
with-tanstack-routerfrom the list - Update the
with-tanstack-routertemplate
P.S. Although option 2 should probably be treated as a separate issue from this PR, I've investigated the root cause and put together a fix. I'll leave those details in a separate comment below.
There was a problem hiding this comment.
I think just remove the with-tanstack-router from t he list would be fine
There was a problem hiding this comment.
Updated the PR to remove with-tanstack-router from the list. I left the deep-dive analysis and potential fixes in the comment below as well
Honest sequence of events: my first reaction was "fair enough, I'll just delete it from the list — one line, done." But then I got curious. One "wait, why doesn't this work?" led to another. That single comment sent me down a delightful rabbit hole, and I came back with the full picture (plus two working fix approaches). TL;DR (Summary for maintainers)
So, the decisions needed:(a) For the v2 template list(Choose one)
(b) For the SSR fix itself(Choose one)
(c) Independent of (b)Should we also roll in the singleton-to-per-request router fix (as recommended by TanStack Router) described in the "Recommended addition" section?
Two fix approaches (both verified locally)Both approaches produce:
Approach A — Fix the template only (no solid-start changes)Leverage the 2nd Move Diff ( -import { createHandler, FetchEvent, StartServer } from "@solidjs/start/server";
+import { createHandler, StartServer } from "@solidjs/start/server";
import { createMemoryHistory } from "@tanstack/solid-router";
import { router } from "./router";
-const routerLoad = async (event: FetchEvent) => {
- const url = new URL(event.request.url);
- const path = url.href.replace(url.origin, "");
- router.update({
- history: createMemoryHistory({ initialEntries: [path] })
- });
- await router.load();
-};
-
export default createHandler(
() => <StartServer document={...} />,
- undefined,
- routerLoad
+ async (context) => {
+ const url = new URL(context.request.url);
+ const path = url.href.replace(url.origin, "");
+ router.update({
+ history: createMemoryHistory({ initialEntries: [path] })
+ });
+ await router.load();
+ return {};
+ }
);Approach B — Restore
|
| Date | PR / Commit | What happened | Evidence |
|---|---|---|---|
| 2025-03-03 | #1840 | Added routerLoad as 4th param to createBaseHandler (then 3rd to createHandler) specifically for TanStack router SSR support |
Patch: routerLoad param added |
| 2025-11-07 | #1942 | Full v2 rewrite of handler.ts (vinxi → h3, major restructuring). routerLoad removed entirely — no replacement API provided. |
Patch: routerLoad removed, createHandler reduced to 2 args (see handler.ts diff) |
| 2026-03-17 | #254 | "Reintegrate SolidStart v1" — copied v1's entry-server.tsx (which uses the 3-arg createHandler with routerLoad) into the v2 template without modification |
Template file |
| 2026-05-06 | solid-docs | docs team | create-handler.mdx still documents routerLoad as a valid API parameter |
| Current main | @solidjs/start main | — | All current releases ship 2-arg createHandler. The SSR bug persists. |
| 2026-07-18 | #2206 | Stream output fix (cancellation-safe `ReadableStream`). Unrelated to this issue (different layer: stream transport vs. router initialization). | N/A |
Notable: TanStack/router#3521 tracks SSR support for the Solid driver — related context but distinct from the routerLoad wiring issue.
Removed with-tanstack-router as it currently has an SSR issue in v2. The detailed deep-dive investigation and fix options have been documented in PR solidjs-community#78 for future reference.
Purpose
This PR cleans up the v2 templates list to align with the solidjs/templates repository.
Context
The template list is currently hardcoded in
constants.ts.but templates are fetched from the
solidjs/templatesrepo.This mismatch can cause issues when templates are added/removed in the templates repo but not reflected here.
Ref: solidjs/templates
Changes
hackernews,notes, v1with-solidbase)Before/After
hackernewsnoteswith-solidbase(v1 version)Sorted order:
with-auth→with-authjs→with-drizzle→with-mdx→with-prisma→with-solid-styled→with-solidbase→with-strict-csp→with-tailwindcss→
with-tanstack-router→with-trpc→with-unocss→with-vitestFiles Changed
packages/create/src/utils/constants.tsAppendix: Future Automation Ideas
To keep the template list in sync with
solidjs/templates, we could consider:solidjs/templatesrepo changesconstants.tswhen v2 templates are added/removedBoth approaches would eliminate manual maintenance and prevent sync issues. Thoughts?
p.s. Thank you for your efforts and for maintaining this project.