Skip to content

Commit 32a3f09

Browse files
authored
Merge branch 'main' into route-with-server
2 parents c4f892b + 30eff51 commit 32a3f09

File tree

171 files changed

+779
-774
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+779
-774
lines changed

e2e/react-start/basic/src/routes/users.$userId.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { ErrorComponent, createFileRoute } from '@tanstack/react-router'
22
import axios from 'redaxios'
3+
import { getRouterInstance } from '@tanstack/react-start'
34
import type { ErrorComponentProps } from '@tanstack/react-router'
45

56
import type { User } from '~/utils/users'
67
import { NotFound } from '~/components/NotFound'
78

89
export const Route = createFileRoute('/users/$userId')({
910
loader: async ({ params: { userId } }) => {
11+
const router = await getRouterInstance()
1012
return await axios
11-
.get<User>('/api/users/' + userId)
13+
.get<User>('/api/users/' + userId, { baseURL: router.options.origin })
1214
.then((r) => r.data)
1315
.catch(() => {
1416
throw new Error('Failed to fetch user')

e2e/react-start/basic/src/routes/users.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Link, Outlet, createFileRoute } from '@tanstack/react-router'
2+
import { getRouterInstance } from '@tanstack/react-start'
23
import axios from 'redaxios'
34

45
import type { User } from '~/utils/users'
56

67
export const Route = createFileRoute('/users')({
78
loader: async () => {
9+
const router = await getRouterInstance()
810
return await axios
9-
.get<Array<User>>('/api/users')
11+
.get<Array<User>>('/api/users', { baseURL: router.options.origin })
1012
.then((r) => r.data)
1113
.catch(() => {
1214
throw new Error('Failed to fetch users')

e2e/react-start/basic/tests/prerendering.spec.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ test.describe('Prerender Static Path Discovery', () => {
1414
// These static routes should be automatically discovered and prerendered
1515
expect(existsSync(join(distDir, 'index.html'))).toBe(true)
1616
expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true)
17-
expect(existsSync(join(distDir, 'users/index.html'))).toBe(true)
1817
expect(existsSync(join(distDir, 'deferred/index.html'))).toBe(true)
1918
expect(existsSync(join(distDir, 'scripts/index.html'))).toBe(true)
2019
expect(existsSync(join(distDir, 'inline-scripts/index.html'))).toBe(true)
@@ -40,14 +39,5 @@ test.describe('Prerender Static Path Discovery', () => {
4039
const html = readFileSync(join(distDir, 'posts/index.html'), 'utf-8')
4140
expect(html).toContain('Select a post.')
4241
})
43-
44-
test('should contain prerendered content in users.html', () => {
45-
const distDir = join(process.cwd(), 'dist', 'client')
46-
expect(existsSync(join(distDir, 'users/index.html'))).toBe(true)
47-
48-
// "Select a user." should be in the prerendered HTML
49-
const html = readFileSync(join(distDir, 'users/index.html'), 'utf-8')
50-
expect(html).toContain('Select a user.')
51-
})
5242
})
5343
})

e2e/react-start/basic/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const prerenderConfiguration = {
2121
'/i-do-not-exist',
2222
'/not-found/via-beforeLoad',
2323
'/not-found/via-loader',
24+
'/users',
2425
].some((p) => page.path.includes(p)),
2526
maxRedirects: 100,
2627
}
@@ -33,7 +34,6 @@ export default defineConfig({
3334
tsConfigPaths({
3435
projects: ['./tsconfig.json'],
3536
}),
36-
// @ts-ignore we want to keep one test with verboseFileRoutes off even though the option is hidden
3737
tanstackStart({
3838
spa: isSpaMode ? spaModeConfiguration : undefined,
3939
prerender: isPrerender ? prerenderConfiguration : undefined,

e2e/solid-start/basic/src/routes/users.$userId.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { createFileRoute } from '@tanstack/solid-router'
22
import axios from 'redaxios'
33

4+
import { getRouterInstance } from '@tanstack/solid-start'
45
import type { User } from '~/utils/users'
56
import { NotFound } from '~/components/NotFound'
67
import { UserErrorComponent } from '~/components/UserErrorComponent'
78

89
export const Route = createFileRoute('/users/$userId')({
910
loader: async ({ params: { userId } }) => {
11+
const router = await getRouterInstance()
1012
return await axios
11-
.get<User>('/api/users/' + userId)
13+
.get<User>('/api/users/' + userId, { baseURL: router.options.origin })
1214
.then((r) => r.data)
1315
.catch(() => {
1416
throw new Error('Failed to fetch user')

e2e/solid-start/basic/src/routes/users.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'
2+
import { getRouterInstance } from '@tanstack/solid-start'
23
import axios from 'redaxios'
34

45
import type { User } from '~/utils/users'
56

67
export const Route = createFileRoute('/users')({
78
loader: async () => {
9+
const router = await getRouterInstance()
810
return await axios
9-
.get<Array<User>>('/api/users')
11+
.get<Array<User>>('/api/users', { baseURL: router.options.origin })
1012
.then((r) => r.data)
1113
.catch(() => {
1214
throw new Error('Failed to fetch users')

e2e/solid-start/basic/tests/prerendering.spec.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ test.describe('Prerender Static Path Discovery', () => {
1414
// These static routes should be automatically discovered and prerendered
1515
expect(existsSync(join(distDir, 'index.html'))).toBe(true)
1616
expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true)
17-
expect(existsSync(join(distDir, 'users/index.html'))).toBe(true)
1817
expect(existsSync(join(distDir, 'deferred/index.html'))).toBe(true)
1918
expect(existsSync(join(distDir, 'scripts/index.html'))).toBe(true)
2019
expect(existsSync(join(distDir, 'inline-scripts/index.html'))).toBe(true)
@@ -40,14 +39,5 @@ test.describe('Prerender Static Path Discovery', () => {
4039
const html = readFileSync(join(distDir, 'posts/index.html'), 'utf-8')
4140
expect(html).toContain('Select a post.')
4241
})
43-
44-
test('should contain prerendered content in users.html', () => {
45-
const distDir = join(process.cwd(), 'dist', 'client')
46-
expect(existsSync(join(distDir, 'users/index.html'))).toBe(true)
47-
48-
// "Select a user." should be in the prerendered HTML
49-
const html = readFileSync(join(distDir, 'users/index.html'), 'utf-8')
50-
expect(html).toContain('Select a user.')
51-
})
5242
})
5343
})

e2e/solid-start/basic/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const prerenderConfiguration = {
2323
'/not-found/via-loader',
2424
'/search-params/default',
2525
'/transition',
26+
'/users',
2627
].some((p) => page.path.includes(p)),
2728
maxRedirects: 100,
2829
}
@@ -35,7 +36,6 @@ export default defineConfig({
3536
tsConfigPaths({
3637
projects: ['./tsconfig.json'],
3738
}),
38-
// @ts-ignore we want to keep one test with verboseFileRoutes off even though the option is hidden
3939
tanstackStart({
4040
spa: isSpaMode ? spaModeConfiguration : undefined,
4141
prerender: isPrerender ? prerenderConfiguration : undefined,

examples/react/authenticated-routes-firebase/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
},
1111
"dependencies": {
1212
"@tailwindcss/postcss": "^4.1.15",
13-
"@tanstack/react-router": "^1.136.8",
14-
"@tanstack/react-router-devtools": "^1.136.8",
15-
"@tanstack/router-plugin": "^1.136.8",
13+
"@tanstack/react-router": "^1.136.11",
14+
"@tanstack/react-router-devtools": "^1.136.11",
15+
"@tanstack/router-plugin": "^1.136.11",
1616
"firebase": "^11.4.0",
1717
"postcss": "^8.5.1",
1818
"react": "^19.0.0",

examples/react/authenticated-routes/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
},
1111
"dependencies": {
1212
"@tailwindcss/postcss": "^4.1.15",
13-
"@tanstack/react-router": "^1.136.8",
14-
"@tanstack/react-router-devtools": "^1.136.8",
15-
"@tanstack/router-plugin": "^1.136.8",
13+
"@tanstack/react-router": "^1.136.11",
14+
"@tanstack/react-router-devtools": "^1.136.11",
15+
"@tanstack/router-plugin": "^1.136.11",
1616
"postcss": "^8.5.1",
1717
"react": "^19.0.0",
1818
"react-dom": "^19.0.0",

0 commit comments

Comments
 (0)