Skip to content
Source
Sign inSign up
TanStack/router

fix(start): share module bindings between server function handlers and their module #8656

Openschiller-manuel(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromfix/server-fn-shared-moduleopened

Showing 31 changed files with 40 additions and 0 deletions (loading 27).

x
0 of 31 viewed, 31 left
6 additions and 0 deletions.changeset/route-split-shared-default-export.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/router-plugin': patch
+'@tanstack/router-utils': patch
+---
+​
+Keep a default-exported named function or class that route code splitting moves into the shared module declared once, and keep it in the shared module.
6 additions and 0 deletions.changeset/server-fn-shared-bindings.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/start-plugin-core': patch
+'@tanstack/router-utils': patch
+---
+​
+Share module-level bindings between a server function's handler and the rest of its module on the server. A class, cache or counter declared next to a server function is now one instance for the handler and for other server code, so serialization adapters registered for such a class match the values the handler returns.
28 additions and 0 deletionse2e/react-start/serialization-adapters/src/routes/server-function/same-module-class.tsxAdded
View file
@@ -0,0 +1,28 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { useState } from 'react'
+import { describeMoney, getBudget } from '~/Money'
+​
+export const Route = createFileRoute('/server-function/same-module-class')({
+ component: RouteComponent,