Skip to content
Source
Sign inSign up
TanStack/router

fix: properly track re-exports of server function factories #6164

Mergedschiller-manuel(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/6164/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

Showing 8 changed files with 38 additions and 0 deletions (loading 5).

x
0 of 8 viewed, 8 left
24 additions and 0 deletionse2e/react-start/server-functions/src/routes/factory/-functions/functions.tsModified
View file
@@ -2,6 +2,10 @@
import { createBarServerFn } from './createBarServerFn'
import { createFooServerFn } from './createFooServerFn'
import { createFakeFn } from './createFakeFn'
+// Test re-export syntax: `export { foo } from './module'`
+import { reexportFactory } from './reexportIndex'
+// Test star re-export syntax: `export * from './module'`
+import { starReexportFactory } from './starReexportIndex'
​
export const fooFn = createFooServerFn().handler(({ context }) => {
return {
@@ -91,3 +95,23 @@
context,
})
+​
+// Test that re-exported factories (using `export { foo } from './module'`) work correctly
+// The middleware from reexportFactory should execute and add { reexport: 'reexport-middleware-executed' } to context
+export const reexportedFactoryFn = reexportFactory().handler(({ context }) => {
+ return {
+ name: 'reexportedFactoryFn',
+ context,
+ }
+})
+​