Skip to content

Conversation

@birkskyum
Copy link
Member

@birkskyum birkskyum commented Oct 28, 2025

closes #5620

Summary by CodeRabbit

  • New Features

    • Added server-side rendering (SSR) support for redirect testing in React Router and Solid Start examples.
  • Bug Fixes

    • Improved not-found route rendering logic in Solid Router's Match component for better redirect state handling.
  • Tests

    • Added e2e tests validating server function redirects during SSR with query integration.
  • Chores

    • Updated @tanstack/solid-query dependency to v5.90.9 across multiple packages.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 28, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds server-function-triggered SSR redirect test routes for React and Solid Start frameworks, updates TanStack Solid Query dependency versions across multiple e2e and example packages, and modifies Solid Router's Match component to handle not-found rendering during redirected states.

Changes

Cohort / File(s) Summary
React Start: SSR Redirect Routes
e2e/react-start/server-functions/src/routes/redirect-test-ssr/index.tsx, e2e/react-start/server-functions/src/routes/redirect-test-ssr/target.tsx
New SSR route files implementing redirect-test-ssr flow: index route with server function that redirects to target, target route rendering success page.
React Start: Route Tree & Tests
e2e/react-start/server-functions/src/routeTree.gen.ts, e2e/react-start/server-functions/tests/server-functions.spec.ts
Auto-generated route tree updated with new SSR redirect routes and type definitions. New e2e test validating server function redirect within SSR context.
Solid Start: SSR Redirect Routes
e2e/solid-start/server-functions/src/routes/redirect-test-ssr/index.tsx, e2e/solid-start/server-functions/src/routes/redirect-test-ssr/target.tsx
New SSR route files for Solid Start mirroring React implementation: index with server function redirect, target with success page.
Solid Start: Route Tree & Tests
e2e/solid-start/server-functions/src/routeTree.gen.ts, e2e/solid-start/server-functions/tests/server-functions.spec.ts
Auto-generated route tree additions for SSR redirect routes. New e2e test for server function redirect in SSR/query context.
TanStack Solid Query Dependency Updates
e2e/solid-router/basic-solid-query-file-based/package.json, e2e/solid-router/basic-solid-query/package.json, e2e/solid-start/basic-solid-query/package.json, e2e/solid-start/query-integration/package.json, e2e/solid-start/server-functions/package.json, e2e/solid-start/server-routes/package.json, examples/solid/basic-solid-query-file-based/package.json, examples/solid/basic-solid-query/package.json, examples/solid/start-basic-solid-query/package.json
Version bumps of @tanstack/solid-query from ^5.90.0 to ^5.90.9 (or ^5.90.6 to ^5.90.9).
Solid Router: Match Component Logic
packages/solid-router/src/Match.tsx
Restructured Outlet rendering: introduced reactive childMatchStatus and shouldShowNotFound flag, replaced Switch/Match with Show-based branching to handle not-found rendering based on redirected state, preserving root-route gating and suspense handling.

Sequence Diagram

sequenceDiagram
    participant Browser
    participant Router
    participant Match as Match (old)
    participant Match2 as Match (new)
    participant NotFound

    Browser->>Router: Navigate to route with server redirect
    
    rect rgb(200, 220, 255)
    Note over Match: Old Flow
    Router->>Match: Render Outlet
    match->>Match: Check next child match
    alt Match found
        Match->>Match: Render child
    else No match (redirected)
        Match->>NotFound: Invariant fails!<br/>"Could not find match"
    end
    end
    
    rect rgb(200, 255, 220)
    Note over Match2: New Flow
    Router->>Match2: Render Outlet (during redirect)
    Match2->>Match2: Get childMatchStatus
    Match2->>Match2: Derive shouldShowNotFound<br/>(check redirected state)
    alt Match exists & not redirected
        Match2->>Match2: Render child route
    else Redirected or no match
        Match2->>Match2: Skip not-found rendering,<br/>await redirect
    end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Specific areas requiring extra attention:
    • packages/solid-router/src/Match.tsx: Complex control-flow restructuring involving reactive signal derivation and conditional branching; verify that not-found state is correctly gated during redirects and that suspense/root-route logic remains sound.
    • Route tree generation files (routeTree.gen.ts): Ensure auto-generated route metadata is consistent across React and Solid frameworks and correctly links parent/child relationships.
    • E2E tests for SSR redirects: Confirm both React and Solid Start test cases properly validate redirect behavior and URL endpoints.

Possibly related PRs

Suggested reviewers

  • brenelz

Poem

🐰 When redirects crash the server's dance,
A rabbit hops to save the chance!
Not-found no more shall make thee fail,
Match.tsx now tells the tale—
SSR redirects now smoothly glide,
With shouldShowNotFound as your guide! 🌟

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch solid-server-function-invariant-error

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19ae762 and 4d70237.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • e2e/react-start/server-functions/src/routeTree.gen.ts (13 hunks)
  • e2e/react-start/server-functions/src/routes/redirect-test-ssr/index.tsx (1 hunks)
  • e2e/react-start/server-functions/src/routes/redirect-test-ssr/target.tsx (1 hunks)
  • e2e/react-start/server-functions/tests/server-functions.spec.ts (1 hunks)
  • e2e/solid-router/basic-solid-query-file-based/package.json (1 hunks)
  • e2e/solid-router/basic-solid-query/package.json (1 hunks)
  • e2e/solid-start/basic-solid-query/package.json (1 hunks)
  • e2e/solid-start/query-integration/package.json (1 hunks)
  • e2e/solid-start/server-functions/package.json (1 hunks)
  • e2e/solid-start/server-functions/src/routeTree.gen.ts (13 hunks)
  • e2e/solid-start/server-functions/src/routes/redirect-test-ssr/index.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/redirect-test-ssr/target.tsx (1 hunks)
  • e2e/solid-start/server-functions/tests/server-functions.spec.ts (1 hunks)
  • e2e/solid-start/server-routes/package.json (1 hunks)
  • examples/solid/basic-solid-query-file-based/package.json (1 hunks)
  • examples/solid/basic-solid-query/package.json (1 hunks)
  • examples/solid/start-basic-solid-query/package.json (1 hunks)
  • packages/solid-router/src/Match.tsx (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Oct 28, 2025

View your CI Pipeline Execution ↗ for commit 4d70237

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 8m 39s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 30s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-03 16:19:55 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 28, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5668

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5668

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5668

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5668

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5668

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5668

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5668

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5668

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5668

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5668

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5668

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5668

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5668

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5668

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5668

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5668

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5668

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5668

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5668

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5668

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5668

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5668

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5668

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@5668

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5668

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5668

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5668

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5668

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5668

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5668

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5668

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5668

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5668

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5668

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5668

commit: 4d70237

@birkskyum birkskyum added this to the catch up solid to react milestone Oct 28, 2025
@birkskyum birkskyum changed the title fix(solid-start): allow redirect inside server function ssr fix(solid-router-ssr-query): allow redirect inside server function ssr Oct 28, 2025
@birkskyum birkskyum force-pushed the solid-server-function-invariant-error branch 2 times, most recently from c404021 to 5646ed3 Compare October 30, 2025 03:15
@birkskyum birkskyum force-pushed the solid-server-function-invariant-error branch from 5646ed3 to 4bbe13c Compare November 1, 2025 12:10
@birkskyum birkskyum marked this pull request as ready for review November 3, 2025 16:24
@birkskyum birkskyum merged commit d558b67 into main Nov 3, 2025
6 checks passed
@birkskyum birkskyum deleted the solid-server-function-invariant-error branch November 3, 2025 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

solid-start: Redirecting inside server functions causes a crash - Invariant failed

3 participants