Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions e2e/react-start/basic/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { Route as SearchParamsDefaultRouteImport } from './routes/search-params/
import { Route as RedirectTargetRouteImport } from './routes/redirect/$target'
import { Route as PostsPostIdRouteImport } from './routes/posts.$postId'
import { Route as NotFoundViaLoaderRouteImport } from './routes/not-found/via-loader'
import { Route as NotFoundViaHeadRouteImport } from './routes/not-found/via-head'
import { Route as NotFoundViaBeforeLoadRouteImport } from './routes/not-found/via-beforeLoad'
import { Route as ApiUsersRouteImport } from './routes/api.users'
import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'
Expand Down Expand Up @@ -169,6 +170,11 @@ const NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({
path: '/via-loader',
getParentRoute: () => NotFoundRouteRoute,
} as any)
const NotFoundViaHeadRoute = NotFoundViaHeadRouteImport.update({
id: '/via-head',
path: '/via-head',
getParentRoute: () => NotFoundRouteRoute,
} as any)
const NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({
id: '/via-beforeLoad',
path: '/via-beforeLoad',
Expand Down Expand Up @@ -272,6 +278,7 @@ export interface FileRoutesByFullPath {
'/대한민국': typeof Char45824Char54620Char48124Char44397Route
'/api/users': typeof ApiUsersRouteWithChildren
'/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute
'/not-found/via-head': typeof NotFoundViaHeadRoute
'/not-found/via-loader': typeof NotFoundViaLoaderRoute
'/posts/$postId': typeof PostsPostIdRoute
'/redirect/$target': typeof RedirectTargetRouteWithChildren
Expand Down Expand Up @@ -307,6 +314,7 @@ export interface FileRoutesByTo {
'/대한민국': typeof Char45824Char54620Char48124Char44397Route
'/api/users': typeof ApiUsersRouteWithChildren
'/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute
'/not-found/via-head': typeof NotFoundViaHeadRoute
'/not-found/via-loader': typeof NotFoundViaLoaderRoute
'/posts/$postId': typeof PostsPostIdRoute
'/search-params/default': typeof SearchParamsDefaultRoute
Expand Down Expand Up @@ -347,6 +355,7 @@ export interface FileRoutesById {
'/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren
'/api/users': typeof ApiUsersRouteWithChildren
'/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute
'/not-found/via-head': typeof NotFoundViaHeadRoute
'/not-found/via-loader': typeof NotFoundViaLoaderRoute
'/posts/$postId': typeof PostsPostIdRoute
'/redirect/$target': typeof RedirectTargetRouteWithChildren
Expand Down Expand Up @@ -389,6 +398,7 @@ export interface FileRouteTypes {
| '/대한민국'
| '/api/users'
| '/not-found/via-beforeLoad'
| '/not-found/via-head'
| '/not-found/via-loader'
| '/posts/$postId'
| '/redirect/$target'
Expand Down Expand Up @@ -424,6 +434,7 @@ export interface FileRouteTypes {
| '/대한민국'
| '/api/users'
| '/not-found/via-beforeLoad'
| '/not-found/via-head'
| '/not-found/via-loader'
| '/posts/$postId'
| '/search-params/default'
Expand Down Expand Up @@ -463,6 +474,7 @@ export interface FileRouteTypes {
| '/_layout/_layout-2'
| '/api/users'
| '/not-found/via-beforeLoad'
| '/not-found/via-head'
| '/not-found/via-loader'
| '/posts/$postId'
| '/redirect/$target'
Expand Down Expand Up @@ -673,6 +685,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof NotFoundViaLoaderRouteImport
parentRoute: typeof NotFoundRouteRoute
}
'/not-found/via-head': {
id: '/not-found/via-head'
path: '/via-head'
fullPath: '/not-found/via-head'
preLoaderRoute: typeof NotFoundViaHeadRouteImport
parentRoute: typeof NotFoundRouteRoute
}
'/not-found/via-beforeLoad': {
id: '/not-found/via-beforeLoad'
path: '/via-beforeLoad'
Expand Down Expand Up @@ -797,12 +816,14 @@ declare module '@tanstack/react-router' {

interface NotFoundRouteRouteChildren {
NotFoundViaBeforeLoadRoute: typeof NotFoundViaBeforeLoadRoute
NotFoundViaHeadRoute: typeof NotFoundViaHeadRoute
NotFoundViaLoaderRoute: typeof NotFoundViaLoaderRoute
NotFoundIndexRoute: typeof NotFoundIndexRoute
}

const NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = {
NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute,
NotFoundViaHeadRoute: NotFoundViaHeadRoute,
NotFoundViaLoaderRoute: NotFoundViaLoaderRoute,
NotFoundIndexRoute: NotFoundIndexRoute,
}
Expand Down
10 changes: 10 additions & 0 deletions e2e/react-start/basic/src/routes/not-found/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ export const Route = createFileRoute('/not-found/')({
via-loader
</Link>
</div>
<div className="mb-2">
<Link
from={Route.fullPath}
to="./via-head"
preload={preload}
data-testid="via-head"
>
via-head
</Link>
</div>
</div>
)
},
Expand Down
23 changes: 23 additions & 0 deletions e2e/react-start/basic/src/routes/not-found/via-head.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { createFileRoute, notFound } from '@tanstack/react-router'

export const Route = createFileRoute('/not-found/via-head')({
head: () => {
throw notFound()
},
component: RouteComponent,
notFoundComponent: () => {
return (
<div data-testid="via-head-notFound-component">
Not Found "/not-found/via-head"!
</div>
)
},
})

function RouteComponent() {
return (
<div data-testid="via-head-route-component" data-server={typeof window}>
Hello "/not-found/via-head"!
</div>
)
}
8 changes: 3 additions & 5 deletions e2e/react-start/basic/tests/not-found.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const combinate = (combinateImport as any).default as typeof combinateImport
test.use({
whitelistErrors: [
/Failed to load resource: the server responded with a status of 404/,
'Error during route context hydration: {isNotFound: true}',
],
})
test.describe('not-found', () => {
Expand All @@ -24,8 +25,7 @@ test.describe('not-found', () => {

test.describe('throw notFound()', () => {
const navigationTestMatrix = combinate({
// TODO beforeLoad!
thrower: [/* 'beforeLoad',*/ 'loader'] as const,
thrower: ['beforeLoad', 'head', 'loader'] as const,
preload: [false, true] as const,
})

Expand Down Expand Up @@ -55,9 +55,7 @@ test.describe('not-found', () => {
})
})
const directVisitTestMatrix = combinate({
// TODO beforeLoad!

thrower: [/* 'beforeLoad',*/ 'loader'] as const,
thrower: ['beforeLoad', 'head', 'loader'] as const,
})

directVisitTestMatrix.forEach(({ thrower }) => {
Expand Down
21 changes: 21 additions & 0 deletions e2e/solid-start/basic/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { Route as SearchParamsDefaultRouteImport } from './routes/search-params/
import { Route as RedirectTargetRouteImport } from './routes/redirect/$target'
import { Route as PostsPostIdRouteImport } from './routes/posts.$postId'
import { Route as NotFoundViaLoaderRouteImport } from './routes/not-found/via-loader'
import { Route as NotFoundViaHeadRouteImport } from './routes/not-found/via-head'
import { Route as NotFoundViaBeforeLoadRouteImport } from './routes/not-found/via-beforeLoad'
import { Route as ApiUsersRouteImport } from './routes/api/users'
import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'
Expand Down Expand Up @@ -156,6 +157,11 @@ const NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({
path: '/via-loader',
getParentRoute: () => NotFoundRouteRoute,
} as any)
const NotFoundViaHeadRoute = NotFoundViaHeadRouteImport.update({
id: '/via-head',
path: '/via-head',
getParentRoute: () => NotFoundRouteRoute,
} as any)
const NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({
id: '/via-beforeLoad',
path: '/via-beforeLoad',
Expand Down Expand Up @@ -244,6 +250,7 @@ export interface FileRoutesByFullPath {
'/users': typeof UsersRouteWithChildren
'/api/users': typeof ApiUsersRouteWithChildren
'/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute
'/not-found/via-head': typeof NotFoundViaHeadRoute
'/not-found/via-loader': typeof NotFoundViaLoaderRoute
'/posts/$postId': typeof PostsPostIdRoute
'/redirect/$target': typeof RedirectTargetRouteWithChildren
Expand Down Expand Up @@ -276,6 +283,7 @@ export interface FileRoutesByTo {
'/stream': typeof StreamRoute
'/api/users': typeof ApiUsersRouteWithChildren
'/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute
'/not-found/via-head': typeof NotFoundViaHeadRoute
'/not-found/via-loader': typeof NotFoundViaLoaderRoute
'/posts/$postId': typeof PostsPostIdRoute
'/search-params/default': typeof SearchParamsDefaultRoute
Expand Down Expand Up @@ -314,6 +322,7 @@ export interface FileRoutesById {
'/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren
'/api/users': typeof ApiUsersRouteWithChildren
'/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute
'/not-found/via-head': typeof NotFoundViaHeadRoute
'/not-found/via-loader': typeof NotFoundViaLoaderRoute
'/posts/$postId': typeof PostsPostIdRoute
'/redirect/$target': typeof RedirectTargetRouteWithChildren
Expand Down Expand Up @@ -352,6 +361,7 @@ export interface FileRouteTypes {
| '/users'
| '/api/users'
| '/not-found/via-beforeLoad'
| '/not-found/via-head'
| '/not-found/via-loader'
| '/posts/$postId'
| '/redirect/$target'
Expand Down Expand Up @@ -384,6 +394,7 @@ export interface FileRouteTypes {
| '/stream'
| '/api/users'
| '/not-found/via-beforeLoad'
| '/not-found/via-head'
| '/not-found/via-loader'
| '/posts/$postId'
| '/search-params/default'
Expand Down Expand Up @@ -421,6 +432,7 @@ export interface FileRouteTypes {
| '/_layout/_layout-2'
| '/api/users'
| '/not-found/via-beforeLoad'
| '/not-found/via-head'
| '/not-found/via-loader'
| '/posts/$postId'
| '/redirect/$target'
Expand Down Expand Up @@ -619,6 +631,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof NotFoundViaLoaderRouteImport
parentRoute: typeof NotFoundRouteRoute
}
'/not-found/via-head': {
id: '/not-found/via-head'
path: '/via-head'
fullPath: '/not-found/via-head'
preLoaderRoute: typeof NotFoundViaHeadRouteImport
parentRoute: typeof NotFoundRouteRoute
}
'/not-found/via-beforeLoad': {
id: '/not-found/via-beforeLoad'
path: '/via-beforeLoad'
Expand Down Expand Up @@ -722,12 +741,14 @@ declare module '@tanstack/solid-router' {

interface NotFoundRouteRouteChildren {
NotFoundViaBeforeLoadRoute: typeof NotFoundViaBeforeLoadRoute
NotFoundViaHeadRoute: typeof NotFoundViaHeadRoute
NotFoundViaLoaderRoute: typeof NotFoundViaLoaderRoute
NotFoundIndexRoute: typeof NotFoundIndexRoute
}

const NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = {
NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute,
NotFoundViaHeadRoute: NotFoundViaHeadRoute,
NotFoundViaLoaderRoute: NotFoundViaLoaderRoute,
NotFoundIndexRoute: NotFoundIndexRoute,
}
Expand Down
10 changes: 10 additions & 0 deletions e2e/solid-start/basic/src/routes/not-found/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ export const Route = createFileRoute('/not-found/')({
via-loader
</Link>
</div>
<div class="mb-2">
<Link
from={Route.fullPath}
to="./via-head"
preload={preload()}
data-testid="via-head"
>
via-head
</Link>
</div>
</div>
)
},
Expand Down
23 changes: 23 additions & 0 deletions e2e/solid-start/basic/src/routes/not-found/via-head.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { createFileRoute, notFound } from '@tanstack/solid-router'

export const Route = createFileRoute('/not-found/via-head')({
head: () => {
throw notFound()
},
component: RouteComponent,
notFoundComponent: () => {
return (
<div data-testid="via-head-notFound-component">
Not Found "/not-found/via-head"!
</div>
)
},
})

function RouteComponent() {
return (
<div data-testid="via-head-route-component" data-server={typeof window}>
Hello "/not-found/via-head"!
</div>
)
}
8 changes: 3 additions & 5 deletions e2e/solid-start/basic/tests/not-found.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const combinate = (combinateImport as any).default as typeof combinateImport
test.use({
whitelistErrors: [
/Failed to load resource: the server responded with a status of 404/,
'Error during route context hydration: {isNotFound: true}',
],
})
test.describe('not-found', () => {
Expand All @@ -24,8 +25,7 @@ test.describe('not-found', () => {

test.describe('throw notFound()', () => {
const navigationTestMatrix = combinate({
// TODO beforeLoad!
thrower: [/* 'beforeLoad',*/ 'loader'] as const,
thrower: ['beforeLoad', 'head', 'loader'] as const,
preload: [false, true] as const,
})

Expand Down Expand Up @@ -54,9 +54,7 @@ test.describe('not-found', () => {
})
})
const directVisitTestMatrix = combinate({
// TODO beforeLoad!

thrower: [/* 'beforeLoad',*/ 'loader'] as const,
thrower: ['beforeLoad', 'head', 'loader'] as const,
})

directVisitTestMatrix.forEach(({ thrower }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBe(7)
expect(updates).toBe(6)
})

test('hover preload, then navigate, w/ async loaders', async () => {
Expand Down
Loading