-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Labels
startEverything about TanStack StartEverything about TanStack Start
Description
Describe the bug
When calling a server function inside another server function, the parameters get altered unexpectedly, causing the outer function to receive modified parameters. This issue prevents the function from being reusable as intended.
Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
- Define two server functions using
createServerFn:
export const serverFn = createServerFn('POST', async (params, ctx) => {
console.log(params)
await server2Fn(params)
return null
})
export const server2Fn = createServerFn('POST', async (params, ctx) => {
console.log(params)
return null
})-
Call the
serverFnfunction with the following parameters:// inside a loader await serverFn({ slug: { eq: 'test' } });
-
Observe the console logs for
paramswithinserverFn:Expected output:
{ "slug": { "eq": "test"} }Actual output:
{ "method": "POST", "payload": { "slug": { "eq": "test" } }, "requestInit": undefined }
Expected behavior
The createServerFn wrapper seems to be adding extra data to the parameters, such as method, payload, and requestInit. This behavior interferes with the intended parameter structure, making it difficult to reuse the server function properly.
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: "@tanstack/react-router": "^1.43.3", "@tanstack/start": "^1.43.3"
Additional context
No response
Metadata
Metadata
Assignees
Labels
startEverything about TanStack StartEverything about TanStack Start
Type
Projects
Status
Done