Skip to content
Source
Sign inSign up
TanStack/router

fix: restructure server function environment handling #6160

Mergedschiller-manuel(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/6160/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

Showing 21 changed files with 117 additions and 0 deletions (loading 17).

x
0 of 21 viewed, 21 left
6 additions and 0 deletionse2e/react-start/server-functions/src/functions/fnOnlyCalledByServer.tsAdded
View file
@@ -0,0 +1,6 @@
+import { createServerFn } from '@tanstack/react-start'
+​
+// This function is ONLY called from the server, never directly from client code
+export const fnOnlyCalledByServer = createServerFn().handler(() => {
+ return { message: 'hello from server-only function', secret: 42 }
+})
e2e/react-start/server-functions/src/routeTree.gen.tsModified
View file
6 additions and 0 deletionse2e/react-start/server-functions/src/routes/index.tsxModified
View file
@@ -88,6 +88,12 @@
<li>
<Link to="/factory">Server Functions Factory E2E tests</Link>
</li>
+ <li>
+ <Link to="/server-only-fn">
+ Server Function only called by Server Environment is kept in the
+ server build
+ </Link>
+ </li>
</ul>