Skip to content

Commit 5d32b97

Browse files
committed
reproduce issue
1 parent 581941a commit 5d32b97

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

examples/react/basic-ssr-streaming-file-based/src/router.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { createRouter as createReactRouter } from '@tanstack/react-router'
1+
import {
2+
createRouter as createReactRouter,
3+
rewriteBasepath,
4+
} from '@tanstack/react-router'
25

36
import { routeTree } from './routeTree.gen'
47

@@ -8,6 +11,7 @@ export function createRouter() {
811
context: {
912
head: '',
1013
},
14+
rewrite: rewriteBasepath({ basepath: 'my-app' }),
1115
defaultPreload: 'intent',
1216
scrollRestoration: true,
1317
})

examples/react/basic-ssr-streaming-file-based/src/routes/posts/$postId.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { Await, createFileRoute, notFound } from '@tanstack/react-router'
1+
import {
2+
Await,
3+
createFileRoute,
4+
notFound,
5+
redirect,
6+
} from '@tanstack/react-router'
27
import * as React from 'react'
38
import type { PostType } from './route'
49

@@ -42,6 +47,9 @@ export const Route = createFileRoute('/posts/$postId')({
4247
commentsPromise: commentsPromise,
4348
}
4449
},
50+
beforeLoad: () => {
51+
throw redirect({to: '/error'})
52+
},
4553
wrapInSuspense: true,
4654
errorComponent: ({ error }) => {
4755
return <div>Failed to load post: {(error as any).message}</div>

0 commit comments

Comments
 (0)