Skip to content

Conversation

@birkskyum
Copy link
Member

@birkskyum birkskyum commented Oct 25, 2025

aligning server-functions e2e to match react

Summary by CodeRabbit

  • New Features

    • Added Server-Side Rendering query integration for improved data fetching and caching.
    • Added middleware support for server functions, enabling custom request/response handling.
    • Added form data redirect capabilities with client and server-side validation.
  • Tests

    • Expanded end-to-end test coverage for new middleware, routing, and primitive type handling scenarios.
  • Chores

    • Added new dependencies for query and router SSR integration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 25, 2025

Walkthrough

The PR adds comprehensive e2e test infrastructure for Solid Start server functions, introducing new routes for primitives, middleware patterns, form data redirects, and factory patterns. It also integrates SSR query support into the Solid Start router, adds corresponding dependencies, updates the route tree, and reorders imports in the React example.

Changes

Cohort / File(s) Change Summary
React Query Integration
e2e/react-start/server-functions/src/router.tsx
Reordered imports to move QueryClient and setupRouterSsrQueryIntegration declarations to the top; functional behavior unchanged.
Solid Start Dependencies
e2e/solid-start/server-functions/package.json
Added @tanstack/solid-query@^5.90.6 and @tanstack/solid-router-ssr-query@workspace:^ dependencies.
Solid Start Router Configuration
e2e/solid-start/server-functions/src/router.tsx
Integrated SSR query support via QueryClient and setupRouterSsrQueryIntegration; added context object { foo: { bar: 'baz' } } to router config.
Solid Start Route Tree
e2e/solid-start/server-functions/src/routeTree.gen.ts
Auto-generated updates adding 8 new route imports/instances (primitives, middleware, formdata-redirect, factory and their children); extended type mappings and RootRouteChildren.
Solid Start Vite Configuration
e2e/solid-start/server-functions/vite.config.ts
Added custom server function ID generator hook returning constant 'constant_id' for specified functions.
Solid Start Factory Functions
e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts, createBarServerFn.ts, createFakeFn.ts, functions.ts
New modules defining server function factories with middleware composition, including fooMiddleware, barMiddleware, and composed handler chains.
Solid Start New Routes
e2e/solid-start/server-functions/src/routes/factory/index.tsx, formdata-redirect/index.tsx, formdata-redirect/target.$name.tsx, middleware/index.tsx, middleware/client-middleware-router.tsx, middleware/request-middleware.tsx, middleware/send-serverFn.tsx, primitives/index.tsx
8 new route files introducing e2e test pages for server functions (primitives, middleware patterns, form data redirects, factory pattern composition).
Solid Start E2E Tests
e2e/solid-start/server-functions/tests/server-functions.spec.ts
Added extensive Playwright test suite covering server function ID verification, formdata redirects, middleware interactions, factory patterns, and primitives testing (with noted test duplication).
Formatting
e2e/solid-start/query-integration/src/routes/loader-fetchQuery/$type.tsx
Removed blank lines around loader property and RouteComponent; no functional change.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Focus areas requiring extra attention:
    • e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx — Complex request middleware setup with context forwarding and loader data handling
    • e2e/solid-start/server-functions/tests/server-functions.spec.ts — Large test file with noted duplicated test blocks requiring consolidation review
    • e2e/solid-start/server-functions/src/routes/factory/-functions/ — Multiple middleware composition patterns and factory chaining logic across 4 files
    • e2e/solid-start/server-functions/src/routeTree.gen.ts — Auto-generated file with 8 new route entries; verify type mappings are complete and correct

Possibly related PRs

Suggested reviewers

  • schiller-manuel
  • brenelz

Poem

🐰 A warren of routes now blooms so bright,
Middleware flows and factories take flight,
Primitives dance with query's warm embrace,
Form redirects find their proper place,
Tests multiply—a forest, not a trace!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "test(solid-start): server-functions e2e" accurately reflects the primary intent of the changeset. The pull request introduces comprehensive end-to-end tests for Solid Start server functions, adds test infrastructure, and aligns the Solid Start setup with React Start patterns. The title follows conventional commit format with the "test" prefix appropriately indicating test-related changes, specifies the scope as "solid-start", and clearly identifies the target as "server-functions e2e". This description is sufficiently specific that a team member scanning the history would understand that the PR focuses on adding e2e test coverage for Solid Start's server function capabilities.
✨ 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 test(solid-start)--sync-server-functions-e2e-to-react-start

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 25, 2025

View your CI Pipeline Execution ↗ for commit de07270

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

☁️ Nx Cloud last updated this comment at 2025-10-26 19:04:25 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 25, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/directive-functions-plugin

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/zod-adapter

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

commit: de07270

@birkskyum birkskyum force-pushed the test(solid-start)--sync-server-functions-e2e-to-react-start branch from b61f68f to 13a2191 Compare October 25, 2025 20:21
@birkskyum birkskyum changed the title test(solid-start): update server-functions e2e to match react test(solid-start): update server-functions e2e Oct 25, 2025
@birkskyum birkskyum added the ssr Everything around SSR the story label Oct 26, 2025
@birkskyum birkskyum added this to the catch up solid to react milestone Oct 26, 2025
@birkskyum birkskyum changed the title test(solid-start): update server-functions e2e test(solid-start): server-functions / query-integrations e2e Oct 26, 2025
@birkskyum birkskyum changed the title test(solid-start): server-functions / query-integrations e2e test(solid-start): server-functions e2e Oct 26, 2025
@birkskyum birkskyum force-pushed the test(solid-start)--sync-server-functions-e2e-to-react-start branch from 4908768 to d42389c Compare October 26, 2025 18:38
@birkskyum birkskyum marked this pull request as ready for review October 26, 2025 19:02
@birkskyum birkskyum merged commit d2ac37c into main Oct 26, 2025
5 of 6 checks passed
@birkskyum birkskyum deleted the test(solid-start)--sync-server-functions-e2e-to-react-start branch October 26, 2025 19:05
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (11)
e2e/solid-start/server-functions/vite.config.ts (1)

6-9: Make function-id matching cross‑platform and faster.

Normalize file paths (Windows vs POSIX) and use a Set for O(1) lookup. Prevents false negatives on Windows devs/CI.

Apply:

+import path from 'node:path'
+
-const FUNCTIONS_WITH_CONSTANT_ID = [
-  'src/routes/submit-post-formdata.tsx/greetUser_createServerFn_handler',
-  'src/routes/formdata-redirect/index.tsx/greetUser_createServerFn_handler',
-]
+const FUNCTIONS_WITH_CONSTANT_ID = new Set([
+  'src/routes/submit-post-formdata.tsx/greetUser_createServerFn_handler',
+  'src/routes/formdata-redirect/index.tsx/greetUser_createServerFn_handler',
+])
+
+const toPosix = (p: string) => p.split(path.sep).join('/')
@@
     tanstackStart({
       serverFns: {
         generateFunctionId: (opts) => {
-          const id = `${opts.filename}/${opts.functionName}`
-          if (FUNCTIONS_WITH_CONSTANT_ID.includes(id)) return 'constant_id'
+          const id = `${toPosix(opts.filename)}/${opts.functionName}`
+          if (FUNCTIONS_WITH_CONSTANT_ID.has(id)) return 'constant_id'
           else return undefined
         },
       },
     }),

Also applies to: 19-27

e2e/solid-start/server-functions/src/routes/factory/-functions/createFakeFn.ts (1)

1-5: Type flexibility: make handler generic instead of Promise only.

Current typing is restrictive. Optional improvement:

-export function createFakeFn() {
-  return {
-    handler: (cb: () => Promise<any>) => cb,
-  }
-}
+export function createFakeFn<TArgs extends any[], TResult>() {
+  return {
+    handler: (cb: (...args: TArgs) => TResult) => cb,
+  }
+}
e2e/solid-start/server-functions/tests/server-functions.spec.ts (2)

335-345: Reduce flakiness: rely on locator auto‑waiting instead of networkidle after click.

Playwright assertions auto‑wait; the extra networkidle after clicks can be flaky in SPAs.

-      await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()
-
-      await page.waitForLoadState('networkidle')
+      await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()
+      // rely on the assertion below to auto-wait

394-403: Trim textContent() before equality checks to avoid whitespace mismatches.

Safer when elements might include incidental spaces/newlines.

-    async function checkEqual(prefix: string) {
-      const requestParam = await page
-        .getByTestId(`${prefix}-data-request-param`)
-        .textContent()
-      expect(requestParam).not.toBe('')
-      const requestFunc = await page
-        .getByTestId(`${prefix}-data-request-func`)
-        .textContent()
-      expect(requestParam).toBe(requestFunc)
-    }
+    async function checkEqual(prefix: string) {
+      const requestParam =
+        (await page.getByTestId(`${prefix}-data-request-param`).textContent())?.trim() || ''
+      expect(requestParam).not.toBe('')
+      const requestFunc =
+        (await page.getByTestId(`${prefix}-data-request-func`).textContent())?.trim() || ''
+      expect(requestParam).toBe(requestFunc)
+    }
e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx (1)

5-22: Consider reordering for clarity.

The middleware references barFn (line 9) before it's defined (line 20). While this works due to JavaScript hoisting and the async nature of middleware execution, defining barFn before the middleware would improve code readability.

Apply this diff to reorder the definitions:

+const barFn = createServerFn().handler(() => {
+  return 'bar'
+})
+
 const middleware = createMiddleware({ type: 'function' }).client(
   async ({ next }) => {
     return next({
       sendContext: {
         serverFn: barFn,
       },
     })
   },
 )

 const fooFn = createServerFn()
   .middleware([middleware])
   .handler(({ context }) => {
     return context.serverFn()
   })
-const barFn = createServerFn().handler(() => {
-  return 'bar'
-})
e2e/solid-start/server-functions/src/routes/primitives/index.tsx (1)

1-9: Add missing newline after imports.

Apply this diff to fix the ESLint error:

 import { For, Show } from 'solid-js'
 import { z } from 'zod'
+
 export const Route = createFileRoute('/primitives/')({
   component: RouteComponent,
   ssr: 'data-only',
 })
e2e/solid-start/server-functions/src/routes/factory/index.tsx (1)

1-20: Sort import members alphabetically.

Apply this diff to fix the ESLint error:

-import { createSignal, For } from 'solid-js'
+import { For, createSignal } from 'solid-js'
e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts (1)

40-41: Gate console logs to reduce test noise.

Wrap with a debug flag or use a logger at debug level to keep CI logs clean.

-    console.log('local middleware triggered')
+    if (process.env.DEBUG?.includes('server-fns')) {
+      console.debug('local middleware triggered')
+    }

Also applies to: 51-52

e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx (3)

4-4: Sort import members as flagged by ESLint.

Alphabetize named imports.

-import { createSignal, Show } from 'solid-js'
+import { Show, createSignal } from 'solid-js'

As per static analysis hints.


31-34: Prefer explicit data type from the server function for clarity.

Typedef once and reuse.

-  const [clientData, setClientData] = createSignal<ReturnType<
-    typeof loaderData
-  > | null>(null)
+  type ServerData = Awaited<ReturnType<typeof serverFn>>
+  const [clientData, setClientData] = createSignal<ServerData | null>(null)

52-57: Optional: handle client call errors.

Avoid unhandled rejections in e2e runs.

-            onClick={async () => {
-              const data = await serverFn()
-              setClientData(data)
-            }}
+            onClick={async () => {
+              try {
+                const data = await serverFn()
+                setClientData(data)
+              } catch (err) {
+                console.error('serverFn failed', err)
+              }
+            }}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 645de23 and de07270.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • e2e/react-start/server-functions/src/router.tsx (1 hunks)
  • e2e/solid-start/query-integration/src/routes/loader-fetchQuery/$type.tsx (0 hunks)
  • e2e/solid-start/server-functions/package.json (1 hunks)
  • e2e/solid-start/server-functions/src/routeTree.gen.ts (11 hunks)
  • e2e/solid-start/server-functions/src/router.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts (1 hunks)
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createFakeFn.ts (1 hunks)
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts (1 hunks)
  • e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts (1 hunks)
  • e2e/solid-start/server-functions/src/routes/factory/index.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/middleware/index.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx (1 hunks)
  • e2e/solid-start/server-functions/src/routes/primitives/index.tsx (1 hunks)
  • e2e/solid-start/server-functions/tests/server-functions.spec.ts (2 hunks)
  • e2e/solid-start/server-functions/vite.config.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • e2e/solid-start/query-integration/src/routes/loader-fetchQuery/$type.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • e2e/solid-start/server-functions/src/routes/factory/-functions/createFakeFn.ts
  • e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/index.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx
  • e2e/solid-start/server-functions/src/router.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts
  • e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts
  • e2e/solid-start/server-functions/src/routes/primitives/index.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx
  • e2e/solid-start/server-functions/tests/server-functions.spec.ts
  • e2e/react-start/server-functions/src/router.tsx
  • e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx
  • e2e/solid-start/server-functions/src/routeTree.gen.ts
  • e2e/solid-start/server-functions/vite.config.ts
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts
  • e2e/solid-start/server-functions/src/routes/factory/index.tsx
**/src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

Place file-based routes under src/routes/ directories

Files:

  • e2e/solid-start/server-functions/src/routes/factory/-functions/createFakeFn.ts
  • e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/index.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts
  • e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts
  • e2e/solid-start/server-functions/src/routes/primitives/index.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx
  • e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts
  • e2e/solid-start/server-functions/src/routes/factory/index.tsx
e2e/**

📄 CodeRabbit inference engine (AGENTS.md)

Store end-to-end tests under the e2e/ directory

Files:

  • e2e/solid-start/server-functions/src/routes/factory/-functions/createFakeFn.ts
  • e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx
  • e2e/solid-start/server-functions/package.json
  • e2e/solid-start/server-functions/src/routes/middleware/index.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx
  • e2e/solid-start/server-functions/src/router.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts
  • e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts
  • e2e/solid-start/server-functions/src/routes/primitives/index.tsx
  • e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx
  • e2e/solid-start/server-functions/tests/server-functions.spec.ts
  • e2e/react-start/server-functions/src/router.tsx
  • e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx
  • e2e/solid-start/server-functions/src/routeTree.gen.ts
  • e2e/solid-start/server-functions/vite.config.ts
  • e2e/solid-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts
  • e2e/solid-start/server-functions/src/routes/factory/index.tsx
**/package.json

📄 CodeRabbit inference engine (AGENTS.md)

Use workspace:* protocol for internal dependencies in package.json files

Files:

  • e2e/solid-start/server-functions/package.json
🧬 Code graph analysis (12)
e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx (1)
e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx (1)
  • Route (5-10)
e2e/solid-start/server-functions/src/routes/middleware/index.tsx (3)
e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx (1)
  • Route (25-28)
e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx (1)
  • Route (23-26)
e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx (1)
  • Route (24-27)
e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx (3)
e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx (1)
  • Route (25-28)
e2e/solid-start/server-functions/src/routes/middleware/index.tsx (1)
  • Route (3-5)
e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx (1)
  • Route (23-26)
e2e/solid-start/server-functions/src/router.tsx (1)
e2e/react-start/server-functions/src/router.tsx (1)
  • getRouter (8-25)
e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx (4)
packages/start-client-core/src/index.tsx (1)
  • getRouterInstance (102-102)
e2e/solid-start/server-functions/src/routes/middleware/index.tsx (1)
  • Route (3-5)
e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx (1)
  • Route (23-26)
e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx (1)
  • Route (24-27)
e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts (3)
e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts (1)
  • createFooServerFn (12-12)
e2e/solid-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts (1)
  • createBarServerFn (13-13)
e2e/solid-start/server-functions/src/routes/factory/-functions/createFakeFn.ts (1)
  • createFakeFn (1-5)
e2e/solid-start/server-functions/src/routes/primitives/index.tsx (7)
e2e/solid-start/server-functions/src/routes/factory/index.tsx (1)
  • Route (17-20)
e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx (1)
  • Route (5-10)
e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx (1)
  • Route (3-5)
e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx (1)
  • Route (25-28)
e2e/solid-start/server-functions/src/routes/middleware/index.tsx (1)
  • Route (3-5)
e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx (1)
  • Route (23-26)
e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx (1)
  • Route (24-27)
e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx (1)
packages/start-server-core/src/request-response.ts (1)
  • getRequest (72-75)
e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx (1)
e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx (1)
  • Route (3-5)
e2e/solid-start/server-functions/vite.config.ts (1)
packages/router-core/src/route.ts (1)
  • id (1547-1549)
e2e/solid-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts (1)
e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts (1)
  • createFooServerFn (12-12)
e2e/solid-start/server-functions/src/routes/factory/index.tsx (2)
e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts (1)
  • fooFnInsideFactoryFile (14-22)
e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts (8)
  • fooFn (6-11)
  • fooFnPOST (13-20)
  • barFn (22-27)
  • barFnPOST (29-36)
  • localFn (58-65)
  • localFnPOST (67-74)
  • composedFn (86-93)
  • fakeFn (76-81)
🪛 ESLint
e2e/solid-start/server-functions/src/routes/primitives/index.tsx

[error] 5-5: Expected 1 empty line after import statement not followed by another import.

(import/newline-after-import)

e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx

[error] 4-4: Member 'Show' of the import declaration should be sorted alphabetically.

(sort-imports)

e2e/solid-start/server-functions/src/routes/factory/index.tsx

[error] 3-3: Member 'For' of the import declaration should be sorted alphabetically.

(sort-imports)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test
  • GitHub Check: Preview
🔇 Additional comments (24)
e2e/react-start/server-functions/src/router.tsx (1)

2-3: LGTM! Import organization improved.

Moving these imports to the top of the file eliminates duplication and follows standard JavaScript/TypeScript conventions for import organization.

e2e/solid-start/server-functions/src/router.tsx (1)

2-4: SSR Query integration wiring looks correct.

QueryClient per request, setup call after router creation, and typed registration are all good.

Also applies to: 9-21, 23-24

e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx (1)

3-15: Route component is concise and correct.

Dynamic param handling and test IDs align with tests.

e2e/solid-start/server-functions/tests/server-functions.spec.ts (1)

7-19: LGTM for constant id URL assertion.

Good coverage to ensure server function action URLs include the constant id.

e2e/solid-start/server-functions/package.json (1)

14-18: @tanstack/solid-query is not an internal monorepo package.

The verification confirms that @tanstack/solid-query is an external npm dependency and not part of this monorepo. The current dependency specification "@tanstack/solid-query": "^5.90.6" at line 14 is correct and should remain unchanged. The workspace:* protocol applies only to internal packages maintained within the monorepo.

Likely an incorrect or invalid review comment.

e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts (2)

1-10: LGTM!

The middleware definition is clean and correctly implements the factory pattern for server-side context augmentation.


12-22: LGTM!

The factory and handler exports are well-structured. The handler correctly returns the context augmented by the middleware.

e2e/solid-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts (2)

1-11: LGTM!

The middleware composition is correctly implemented, following the same pattern as the foo middleware.


13-22: LGTM!

The composed factory and handler are correctly implemented. The middleware composition will result in both foo and bar being present in the context.

e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx (3)

1-10: LGTM!

The route definition with search validation is correctly implemented.


12-33: LGTM!

The server function correctly validates FormData input and uses the redirect pattern appropriately. The validation ensures both the data type and required field are present.


35-74: LGTM!

The component correctly implements progressive enhancement, handling both JavaScript-enabled and no-JavaScript modes for form submission.

e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx (1)

24-27: LGTM!

The route definition correctly sets up the loader to invoke the server function.

e2e/solid-start/server-functions/src/routes/middleware/index.tsx (1)

1-39: LGTM!

The middleware index route correctly provides navigation to the various middleware test cases. The reloadDocument={true} on the request-middleware link is appropriate for testing request-level middleware.

e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx (1)

1-28: LGTM!

The middleware correctly accesses the router instance using getRouterInstance() and passes the router context to the server function.

e2e/solid-start/server-functions/src/routes/primitives/index.tsx (3)

11-37: LGTM!

The server functions correctly handle primitive types with appropriate validators. The stringify helper properly handles the undefined case.


39-96: LGTM!

The test infrastructure correctly uses @tanstack/solid-query to test server functions with primitive types. The handling of undefined values is consistent throughout.


97-136: LGTM!

The test cases comprehensively cover the primitive types (null, undefined, string) for both GET and POST methods.

e2e/solid-start/server-functions/src/routes/factory/index.tsx (2)

28-115: LGTM!

The test cases correctly define expected outputs based on middleware composition. The context objects properly reflect the cumulative effect of nested middleware.


117-184: LGTM!

The test infrastructure correctly uses deepEqual for comparison and provides clear UI feedback for each test case.

e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts (3)

83-88: Confirm middleware accepts a server-fn factory.

Passing createBarServerFn into .middleware([...]) is unconventional; ensure the API supports factories here (not only middleware created via createMiddleware).


6-27: Handlers and method variants look consistent.

Factory usage, POST overrides, and context passing read correctly.

Also applies to: 29-36, 58-66, 67-75, 86-93


76-81: ****

fakeFn is not a server function—it's a plain async function created by createFakeFn, which returns the handler callback as-is without wrapping it as a server function. The function runs exclusively client-side (invoked via the onClick handler in the test component) where window is available and valid. The test marks fakeFn with type: 'localFn' and expects the window object in the output. The code is correct as written.

Likely an incorrect or invalid review comment.

e2e/solid-start/server-functions/src/routeTree.gen.ts (1)

25-35: Generated route additions look consistent.

New routes are wired across imports, instances, maps, unions, and children. No manual edits recommended; keep this file generated.

Re-run the route generator after resolving upstream blocks to ensure this stays in sync.

Also applies to: 101-120, 126-153, 155-179, 198-204, 221-229, 248-257, 273-281, 298-306, 428-455, 463-483, 491-497, 516-525

Comment on lines +53 to +65
<p>
serverFn when invoked in the loader returns:
<br />
<span data-testid="serverFn-loader-result">
{JSON.stringify(serverFnClientResult())}
</span>
</p>
<p>
serverFn when invoked on the client returns:
<br />
<span data-testid="serverFn-client-result">
{JSON.stringify(loaderData().serverFnLoaderResult)}
</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix swapped display of loader and client results.

The same bug exists here as in send-serverFn.tsx:

  • Line 57 (testid: "serverFn-loader-result") displays serverFnClientResult() instead of loader data
  • Line 64 (testid: "serverFn-client-result") displays loaderData().serverFnLoaderResult instead of client result

Apply this diff to fix the swapped data:

       <p>
         serverFn when invoked in the loader returns:
         <br />
         <span data-testid="serverFn-loader-result">
-          {JSON.stringify(serverFnClientResult())}
+          {JSON.stringify(loaderData().serverFnLoaderResult)}
         </span>
       </p>
       <p>
         serverFn when invoked on the client returns:
         <br />
         <span data-testid="serverFn-client-result">
-          {JSON.stringify(loaderData().serverFnLoaderResult)}
+          {JSON.stringify(serverFnClientResult())}
         </span>
       </p>
🤖 Prompt for AI Agents
In
e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx
around lines 53 to 65, the loader and client result spans are swapped: the span
with data-testid "serverFn-loader-result" is rendering serverFnClientResult()
and the span with data-testid "serverFn-client-result" is rendering
loaderData().serverFnLoaderResult; swap the rendered expressions so
"serverFn-loader-result" displays loaderData().serverFnLoaderResult and
"serverFn-client-result" displays serverFnClientResult().

Comment on lines +53 to +65
serverFn when invoked in the loader returns:
<br />
<span data-testid="serverFn-loader-result">
{JSON.stringify(serverFnClientResult())}
</span>
</p>
<p>
serverFn when invoked on the client returns:
<br />
<span data-testid="serverFn-client-result">
{JSON.stringify(loaderData().serverFnLoaderResult)}
</span>
</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix swapped display of loader and client results.

Lines 56 and 63 have their data sources swapped:

  • Line 56 (testid: "serverFn-loader-result") displays serverFnClientResult() instead of loader data
  • Line 63 (testid: "serverFn-client-result") displays loaderData().serverFnLoaderResult instead of client result

Apply this diff to fix the swapped data:

       <p>
         serverFn when invoked in the loader returns:
         <br />
         <span data-testid="serverFn-loader-result">
-          {JSON.stringify(serverFnClientResult())}
+          {JSON.stringify(loaderData().serverFnLoaderResult)}
         </span>
       </p>
       <p>
         serverFn when invoked on the client returns:
         <br />
         <span data-testid="serverFn-client-result">
-          {JSON.stringify(loaderData().serverFnLoaderResult)}
+          {JSON.stringify(serverFnClientResult())}
         </span>
       </p>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
serverFn when invoked in the loader returns:
<br />
<span data-testid="serverFn-loader-result">
{JSON.stringify(serverFnClientResult())}
</span>
</p>
<p>
serverFn when invoked on the client returns:
<br />
<span data-testid="serverFn-client-result">
{JSON.stringify(loaderData().serverFnLoaderResult)}
</span>
</p>
serverFn when invoked in the loader returns:
<br />
<span data-testid="serverFn-loader-result">
{JSON.stringify(loaderData().serverFnLoaderResult)}
</span>
</p>
<p>
serverFn when invoked on the client returns:
<br />
<span data-testid="serverFn-client-result">
{JSON.stringify(serverFnClientResult())}
</span>
</p>
🤖 Prompt for AI Agents
In e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx
around lines 53 to 65, the displayed values for the two spans are swapped: the
span with data-testid="serverFn-loader-result" currently renders
serverFnClientResult() and the span with data-testid="serverFn-client-result"
renders loaderData().serverFnLoaderResult; swap the expressions so the
loader-result span renders JSON.stringify(loaderData().serverFnLoaderResult) and
the client-result span renders JSON.stringify(serverFnClientResult()) (preserve
the JSON.stringify wrapping and surrounding markup).

Comment on lines +328 to +353
test.describe('formdata redirect modes', () => {
for (const mode of ['js', 'no-js']) {
test(`Server function can redirect when sending formdata: mode = ${mode}`, async ({
page,
}) => {
await page.goto('/formdata-redirect?mode=' + mode)

await page.waitForLoadState('networkidle')
const expected =
(await page
.getByTestId('expected-submit-post-formdata-server-fn-result')
.textContent()) || ''
expect(expected).not.toBe('')

await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()

await page.waitForLoadState('networkidle')

await expect(
page.getByTestId('formdata-redirect-target-name'),
).toContainText(expected)

expect(page.url().endsWith(`/formdata-redirect/target/${expected}`))
})
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix missing assertion: currently a no‑op, test won’t fail on wrong URL.

The expect(page.url().endsWith(...)) call lacks a matcher. Use toHaveURL or assert truthiness.

Apply one of:

-      expect(page.url().endsWith(`/formdata-redirect/target/${expected}`))
+      await expect(page).toHaveURL(new RegExp(`/formdata-redirect/target/${expected}$`))

or (no RegExp):

-      expect(page.url().endsWith(`/formdata-redirect/target/${expected}`))
+      expect(page.url().endsWith(`/formdata-redirect/target/${expected}`)).toBe(true)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test.describe('formdata redirect modes', () => {
for (const mode of ['js', 'no-js']) {
test(`Server function can redirect when sending formdata: mode = ${mode}`, async ({
page,
}) => {
await page.goto('/formdata-redirect?mode=' + mode)
await page.waitForLoadState('networkidle')
const expected =
(await page
.getByTestId('expected-submit-post-formdata-server-fn-result')
.textContent()) || ''
expect(expected).not.toBe('')
await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()
await page.waitForLoadState('networkidle')
await expect(
page.getByTestId('formdata-redirect-target-name'),
).toContainText(expected)
expect(page.url().endsWith(`/formdata-redirect/target/${expected}`))
})
}
})
test.describe('formdata redirect modes', () => {
for (const mode of ['js', 'no-js']) {
test(`Server function can redirect when sending formdata: mode = ${mode}`, async ({
page,
}) => {
await page.goto('/formdata-redirect?mode=' + mode)
await page.waitForLoadState('networkidle')
const expected =
(await page
.getByTestId('expected-submit-post-formdata-server-fn-result')
.textContent()) || ''
expect(expected).not.toBe('')
await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()
await page.waitForLoadState('networkidle')
await expect(
page.getByTestId('formdata-redirect-target-name'),
).toContainText(expected)
await expect(page).toHaveURL(new RegExp(`/formdata-redirect/target/${expected}$`))
})
}
})
🤖 Prompt for AI Agents
In e2e/solid-start/server-functions/tests/server-functions.spec.ts around lines
328 to 353, the final assertion uses
expect(page.url().endsWith(`/formdata-redirect/target/${expected}`)) without a
matcher so it does nothing; replace it with a proper assertion such as await
expect(page).toHaveURL(new RegExp(`/formdata-redirect/target/${expected}$`)) or
assert truthiness with
expect(page.url().endsWith(`/formdata-redirect/target/${expected}`)).toBe(true)
(or .toBeTruthy()) to ensure the test fails when the URL is incorrect.

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.

1 participant