TanStack / router

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.
https://tanstack.com/router
MIT License
8.19k stars 646 forks source link

Payload passed incorrectly to server function when called from another server function #2481

Closed lucasthevenet closed 1 hour ago

lucasthevenet commented 1 month ago

Which project does this relate to?

Start

Describe the bug

When calling a server function from another server function, the payload is passed incorrectly, wrapped in an object shaped like { method: "POST", payload: ... }

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-t7wcgv?file=app%2Froutes%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. Go to app/routes/index.tsx route
  2. Press "test server function" button
  3. Compare the results of the function being called directly and the function being called inside another server function

Expected behavior

As a user, I expect the payload to be the same calling the function directly and calling the function from another function

Screenshots or Videos

No response

Platform

Additional context

No response

SeanCassiere commented 1 month ago

This looks to be related to https://github.com/TanStack/router/issues/1866 (if not a duplicate of the issue).

Keeping this on hold for the time being as the server function rewrite is underway. This rewrite has implications on how the endpoint's input is accepted and passed to another.

Once the rewrite has been released, this scenario shall be retested and either closed or have further changes made to ensure this works as expected.