Skip to content

Commit eab09b6

Browse files
committed
fixup! feat: add route for special character pipe in path and corresponding tests
1 parent 4eaf78d commit eab09b6

5 files changed

Lines changed: 43 additions & 29 deletions

File tree

‎e2e/react-router/basic-file-based/src/routeTree.gen.ts‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
1010

1111
import { Route as rootRouteImport } from './routes/__root'
12-
import { Route as SpecialChar124pipeRouteImport } from './routes/special|pipe'
1312
import { Route as RemountDepsRouteImport } from './routes/remountDeps'
1413
import { Route as PostsRouteImport } from './routes/posts'
1514
import { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'
@@ -34,6 +33,7 @@ import { Route as StructuralSharingEnabledRouteImport } from './routes/structura
3433
import { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default'
3534
import { Route as RedirectTargetRouteImport } from './routes/redirect/$target'
3635
import { Route as PostsPostIdRouteImport } from './routes/posts.$postId'
36+
import { Route as PipeReferenceRouteImport } from './routes/pipe.$reference'
3737
import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'
3838
import { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'
3939
import { Route as groupInsideRouteImport } from './routes/(group)/inside'
@@ -119,11 +119,6 @@ import { Route as NonNestedDeepBazBarFooRouteRouteImport } from './routes/non-ne
119119
import { Route as NonNestedDeepBazBarFooIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.index'
120120
import { Route as NonNestedDeepBazBarFooQuxRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo_.qux'
121121

122-
const SpecialChar124pipeRoute = SpecialChar124pipeRouteImport.update({
123-
id: '/special|pipe',
124-
path: '/special|pipe',
125-
getParentRoute: () => rootRouteImport,
126-
} as any)
127122
const RemountDepsRoute = RemountDepsRouteImport.update({
128123
id: '/remountDeps',
129124
path: '/remountDeps',
@@ -245,6 +240,11 @@ const PostsPostIdRoute = PostsPostIdRouteImport.update({
245240
path: '/$postId',
246241
getParentRoute: () => PostsRoute,
247242
} as any)
243+
const PipeReferenceRoute = PipeReferenceRouteImport.update({
244+
id: '/pipe/$reference',
245+
path: '/pipe/$reference',
246+
getParentRoute: () => rootRouteImport,
247+
} as any)
248248
const LayoutLayout2Route = LayoutLayout2RouteImport.update({
249249
id: '/_layout-2',
250250
getParentRoute: () => LayoutRoute,
@@ -721,7 +721,6 @@ export interface FileRoutesByFullPath {
721721
'/notRemountDeps': typeof NotRemountDepsRoute
722722
'/posts': typeof PostsRouteWithChildren
723723
'/remountDeps': typeof RemountDepsRoute
724-
'/special|pipe': typeof SpecialChar124pipeRoute
725724
'/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren
726725
'/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren
727726
'/non-nested/path': typeof NonNestedPathRouteRouteWithChildren
@@ -733,6 +732,7 @@ export interface FileRoutesByFullPath {
733732
'/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute
734733
'/inside': typeof groupInsideRoute
735734
'/lazyinside': typeof groupLazyinsideRoute
735+
'/pipe/$reference': typeof PipeReferenceRoute
736736
'/posts/$postId': typeof PostsPostIdRoute
737737
'/redirect/$target': typeof RedirectTargetRouteWithChildren
738738
'/search-params/default': typeof SearchParamsDefaultRoute
@@ -826,7 +826,6 @@ export interface FileRoutesByTo {
826826
'/masks': typeof MasksRouteWithChildren
827827
'/notRemountDeps': typeof NotRemountDepsRoute
828828
'/remountDeps': typeof RemountDepsRoute
829-
'/special|pipe': typeof SpecialChar124pipeRoute
830829
'/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren
831830
'/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren
832831
'/non-nested/path': typeof NonNestedPathRouteRouteWithChildren
@@ -838,6 +837,7 @@ export interface FileRoutesByTo {
838837
'/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute
839838
'/inside': typeof groupInsideRoute
840839
'/lazyinside': typeof groupLazyinsideRoute
840+
'/pipe/$reference': typeof PipeReferenceRoute
841841
'/posts/$postId': typeof PostsPostIdRoute
842842
'/search-params/default': typeof SearchParamsDefaultRoute
843843
'/structural-sharing/$enabled': typeof StructuralSharingEnabledRoute
@@ -926,7 +926,6 @@ export interface FileRoutesById {
926926
'/notRemountDeps': typeof NotRemountDepsRoute
927927
'/posts': typeof PostsRouteWithChildren
928928
'/remountDeps': typeof RemountDepsRoute
929-
'/special|pipe': typeof SpecialChar124pipeRoute
930929
'/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren
931930
'/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren
932931
'/non-nested/path': typeof NonNestedPathRouteRouteWithChildren
@@ -941,6 +940,7 @@ export interface FileRoutesById {
941940
'/(group)/inside': typeof groupInsideRoute
942941
'/(group)/lazyinside': typeof groupLazyinsideRoute
943942
'/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren
943+
'/pipe/$reference': typeof PipeReferenceRoute
944944
'/posts/$postId': typeof PostsPostIdRoute
945945
'/redirect/$target': typeof RedirectTargetRouteWithChildren
946946
'/search-params/default': typeof SearchParamsDefaultRoute
@@ -1038,7 +1038,6 @@ export interface FileRouteTypes {
10381038
| '/notRemountDeps'
10391039
| '/posts'
10401040
| '/remountDeps'
1041-
| '/special|pipe'
10421041
| '/non-nested/deep'
10431042
| '/non-nested/named'
10441043
| '/non-nested/path'
@@ -1050,6 +1049,7 @@ export interface FileRouteTypes {
10501049
| '/onlyrouteinside'
10511050
| '/inside'
10521051
| '/lazyinside'
1052+
| '/pipe/$reference'
10531053
| '/posts/$postId'
10541054
| '/redirect/$target'
10551055
| '/search-params/default'
@@ -1143,7 +1143,6 @@ export interface FileRouteTypes {
11431143
| '/masks'
11441144
| '/notRemountDeps'
11451145
| '/remountDeps'
1146-
| '/special|pipe'
11471146
| '/non-nested/deep'
11481147
| '/non-nested/named'
11491148
| '/non-nested/path'
@@ -1155,6 +1154,7 @@ export interface FileRouteTypes {
11551154
| '/onlyrouteinside'
11561155
| '/inside'
11571156
| '/lazyinside'
1157+
| '/pipe/$reference'
11581158
| '/posts/$postId'
11591159
| '/search-params/default'
11601160
| '/structural-sharing/$enabled'
@@ -1242,7 +1242,6 @@ export interface FileRouteTypes {
12421242
| '/notRemountDeps'
12431243
| '/posts'
12441244
| '/remountDeps'
1245-
| '/special|pipe'
12461245
| '/non-nested/deep'
12471246
| '/non-nested/named'
12481247
| '/non-nested/path'
@@ -1257,6 +1256,7 @@ export interface FileRouteTypes {
12571256
| '/(group)/inside'
12581257
| '/(group)/lazyinside'
12591258
| '/_layout/_layout-2'
1259+
| '/pipe/$reference'
12601260
| '/posts/$postId'
12611261
| '/redirect/$target'
12621262
| '/search-params/default'
@@ -1354,14 +1354,14 @@ export interface RootRouteChildren {
13541354
NotRemountDepsRoute: typeof NotRemountDepsRoute
13551355
PostsRoute: typeof PostsRouteWithChildren
13561356
RemountDepsRoute: typeof RemountDepsRoute
1357-
SpecialChar124pipeRoute: typeof SpecialChar124pipeRoute
13581357
ParamsPsNonNestedRouteRoute: typeof ParamsPsNonNestedRouteRouteWithChildren
13591358
RelativeLinkRouteRoute: typeof RelativeLinkRouteRouteWithChildren
13601359
RelativeUseNavigateRouteRoute: typeof RelativeUseNavigateRouteRouteWithChildren
13611360
anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute
13621361
groupLayoutRoute: typeof groupLayoutRouteWithChildren
13631362
groupInsideRoute: typeof groupInsideRoute
13641363
groupLazyinsideRoute: typeof groupLazyinsideRoute
1364+
PipeReferenceRoute: typeof PipeReferenceRoute
13651365
RedirectTargetRoute: typeof RedirectTargetRouteWithChildren
13661366
StructuralSharingEnabledRoute: typeof StructuralSharingEnabledRoute
13671367
ParamsPsIndexRoute: typeof ParamsPsIndexRoute
@@ -1387,13 +1387,6 @@ export interface RootRouteChildren {
13871387

13881388
declare module '@tanstack/react-router' {
13891389
interface FileRoutesByPath {
1390-
'/special|pipe': {
1391-
id: '/special|pipe'
1392-
path: '/special|pipe'
1393-
fullPath: '/special|pipe'
1394-
preLoaderRoute: typeof SpecialChar124pipeRouteImport
1395-
parentRoute: typeof rootRouteImport
1396-
}
13971390
'/remountDeps': {
13981391
id: '/remountDeps'
13991392
path: '/remountDeps'
@@ -1562,6 +1555,13 @@ declare module '@tanstack/react-router' {
15621555
preLoaderRoute: typeof PostsPostIdRouteImport
15631556
parentRoute: typeof PostsRoute
15641557
}
1558+
'/pipe/$reference': {
1559+
id: '/pipe/$reference'
1560+
path: '/pipe/$reference'
1561+
fullPath: '/pipe/$reference'
1562+
preLoaderRoute: typeof PipeReferenceRouteImport
1563+
parentRoute: typeof rootRouteImport
1564+
}
15651565
'/_layout/_layout-2': {
15661566
id: '/_layout/_layout-2'
15671567
path: ''
@@ -2618,14 +2618,14 @@ const rootRouteChildren: RootRouteChildren = {
26182618
NotRemountDepsRoute: NotRemountDepsRoute,
26192619
PostsRoute: PostsRouteWithChildren,
26202620
RemountDepsRoute: RemountDepsRoute,
2621-
SpecialChar124pipeRoute: SpecialChar124pipeRoute,
26222621
ParamsPsNonNestedRouteRoute: ParamsPsNonNestedRouteRouteWithChildren,
26232622
RelativeLinkRouteRoute: RelativeLinkRouteRouteWithChildren,
26242623
RelativeUseNavigateRouteRoute: RelativeUseNavigateRouteRouteWithChildren,
26252624
anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,
26262625
groupLayoutRoute: groupLayoutRouteWithChildren,
26272626
groupInsideRoute: groupInsideRoute,
26282627
groupLazyinsideRoute: groupLazyinsideRoute,
2628+
PipeReferenceRoute: PipeReferenceRoute,
26292629
RedirectTargetRoute: RedirectTargetRouteWithChildren,
26302630
StructuralSharingEnabledRoute: StructuralSharingEnabledRoute,
26312631
ParamsPsIndexRoute: ParamsPsIndexRoute,

‎e2e/react-router/basic-file-based/src/routes/__root.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ function RootComponent() {
156156
>
157157
Masks
158158
</Link>{' '}
159+
<Link
160+
to="/pipe/$reference"
161+
params={{ reference: 'hello|world' }}
162+
activeProps={{
163+
className: 'font-bold',
164+
}}
165+
>
166+
Dynamic Pipe Character
167+
</Link>{' '}
159168
<Link
160169
to="/pathless-layout"
161170
data-testid="link-to-pathless-layout"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createFileRoute } from '@tanstack/react-router'
2+
3+
export const Route = createFileRoute('/pipe/$reference')({
4+
component: RouteComponent,
5+
})
6+
7+
function RouteComponent() {
8+
const params = Route.useParams()
9+
return <h4>Hello {params.reference}!</h4>
10+
}

‎e2e/react-router/basic-file-based/src/routes/special|pipe.tsx‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎e2e/react-router/basic-file-based/tests/app.spec.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ test.describe('Special characters in route paths', () => {
400400
page,
401401
baseURL,
402402
}) => {
403-
await page.goto('/special|pipe')
403+
await page.goto('/pipe/hello|world')
404404

405-
await expect(page.locator('body')).toContainText('Hello /special|pipe!')
405+
await expect(page.locator('body')).toContainText('Hello hello|world!')
406406

407-
expect(page.url()).toBe(`${baseURL}/special%7Cpipe`)
407+
expect(page.url()).toBe(`${baseURL}/pipe/hello%7Cworld`)
408408
})
409409
})

0 commit comments

Comments
 (0)