You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/start/framework/react/server-functions.md
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -224,6 +224,52 @@ Cache server function results at build time for static generation. See [Static S
224
224
225
225
Handle request cancellation with `AbortSignal` for long-running operations.
226
226
227
+
### Function ID generation
228
+
229
+
Server functions are addressed by a generated, stable function ID under the hood. These IDs are embedded into the client/SSR builds and used by the server to locate and import the correct module at runtime.
230
+
231
+
Defaults:
232
+
233
+
- In development, IDs are URL-safe strings derived from `${filename}--${functionName}` to aid debugging.
234
+
- In production, IDs are SHA256 hashes of the same seed to keep bundles compact and avoid leaking file paths.
235
+
- If two server functions end up with the same ID (including when using a custom generator), the system de-duplicates by appending an incrementing suffix like `_1`, `_2`, etc.
236
+
- IDs are stable for a given file/function tuple for the lifetime of the process (hot updates keep the same mapping).
237
+
238
+
Customization:
239
+
240
+
You can customize function ID generation by providing a `generateFunctionId` function when configuring the TanStack Start Vite plugin:
- Prefer deterministic inputs (filename + functionName) so IDs remain stable between builds.
270
+
- If you don’t want file paths in dev IDs, return a hash in all environments.
271
+
- Ensure the returned ID is **URL-safe**.
272
+
227
273
---
228
274
229
275
> **Note**: Server functions use a compilation process that extracts server code from client bundles while maintaining seamless calling patterns. On the client, calls become `fetch` requests to the server.
0 commit comments