fix: register createServerFn fetcher as serializable#5268
fix: register createServerFn fetcher as serializable#5268schiller-manuel merged 3 commits intomainfrom
Conversation
WalkthroughAdds a TSS_SERVER_FUNCTION symbol flag to client fetcher types and tests; refactors router-core serializer typing by introducing DefaultSerializable and SerializableExtensions and redefining Serializable; and re-exports those serializer types from router-core's public API. Changes
Sequence Diagram(s)(Skipped — changes are type/API surface updates without runtime control-flow modifications.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/src/routes/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
e2e/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
⏰ 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)
🔇 Additional comments (1)
Comment |
|
View your CI Pipeline Execution ↗ for commit eca3de4
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/nitro-v2-vite-plugin
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-static-server-functions
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
6f7731f to
0272efb
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
packages/router-core/src/index.ts(1 hunks)packages/router-core/src/ssr/serializer/transformer.ts(1 hunks)packages/start-client-core/src/createServerFn.ts(2 hunks)packages/start-client-core/src/createStart.ts(2 hunks)packages/start-client-core/src/tests/createServerFn.test-d.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/start-client-core/src/createServerFn.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
packages/router-core/src/index.tspackages/router-core/src/ssr/serializer/transformer.tspackages/start-client-core/src/createStart.tspackages/start-client-core/src/tests/createServerFn.test-d.ts
packages/router-core/**
📄 CodeRabbit inference engine (AGENTS.md)
Keep framework-agnostic core router logic in packages/router-core/
Files:
packages/router-core/src/index.tspackages/router-core/src/ssr/serializer/transformer.ts
packages/{*-start,start-*}/**
📄 CodeRabbit inference engine (AGENTS.md)
Name and place Start framework packages under packages/-start/ or packages/start-/
Files:
packages/start-client-core/src/createStart.tspackages/start-client-core/src/tests/createServerFn.test-d.ts
🧬 Code graph analysis (3)
packages/router-core/src/ssr/serializer/transformer.ts (1)
packages/router-core/src/index.ts (3)
DefaultSerializable(424-424)SerializableExtensions(423-423)Serializable(425-425)
packages/start-client-core/src/createStart.ts (3)
packages/router-core/src/index.ts (1)
SerializableExtensions(423-423)packages/router-core/src/ssr/serializer/transformer.ts (1)
SerializableExtensions(22-22)packages/start-client-core/src/index.tsx (1)
TSS_SERVER_FUNCTION(86-86)
packages/start-client-core/src/tests/createServerFn.test-d.ts (2)
packages/start-client-core/src/createServerFn.ts (1)
createServerFn(51-170)packages/start-client-core/src/index.tsx (2)
createServerFn(16-16)TSS_SERVER_FUNCTION(86-86)
⏰ 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). (1)
- GitHub Check: Test
| @@ -1,4 +1,5 @@ | |||
| import { createMiddleware } from './createMiddleware' | |||
| import type { TSS_SERVER_FUNCTION } from './constants' | |||
There was a problem hiding this comment.
Import TSS_SERVER_FUNCTION as a value so the computed property type-checks.
import type removes the runtime symbol, so when this module augmentation evaluates [TSS_SERVER_FUNCTION] there is no corresponding value and the file fails to compile ('TSS_SERVER_FUNCTION' only refers to a type, but is being used as a value here.). Pull the symbol in as a normal import (and keep using it in the ambient declaration) so the unique symbol is available.
-import type { TSS_SERVER_FUNCTION } from './constants'
+import { TSS_SERVER_FUNCTION } from './constants'Also applies to: 120-122
🤖 Prompt for AI Agents
In packages/start-client-core/src/createStart.ts around lines 2 and also lines
120-122, the symbol TSS_SERVER_FUNCTION is currently imported with "import type"
so it is erased at runtime and the module augmentation that uses
[TSS_SERVER_FUNCTION] fails to compile; change the import to a normal value
import (remove the "type" qualifier) so the unique symbol/value is present at
runtime and keep using that same identifier in the ambient declaration to allow
the computed property to type-check and compile.
* fix: createServerFn fetcher has TSS_SERVER_FUNCTION symbol prop * add serializer extension, register server functions to be serializable * remove cast
Summary by CodeRabbit
New Features
Refactor
Tests