-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(router-core): Non nested paths - only strip trailing underscore on route segments #5182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
570 changes: 504 additions & 66 deletions
570
e2e/react-router/basic-file-based/src/routeTree.gen.ts
Large diffs are not rendered by default.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
e2e/react-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
e2e/react-router/basic-file-based/src/routes/non-nested/baz.tsx
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
e2e/react-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/named/$baz/foo')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
|
|
||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-named-baz-foo-heading"> | ||
| Hello nested named baz foo page | ||
| </div> | ||
| <div data-testid="non-nested-named-baz-foo-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
19 changes: 19 additions & 0 deletions
19
e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/named/$baz/')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-named-baz-index-heading"> | ||
| Hello nested named baz index | ||
| </div> | ||
| <div data-testid="non-nested-named-baz-index-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
16 changes: 16 additions & 0 deletions
16
e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Outlet, createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/named/$baz')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-named-baz-route-heading"> | ||
| Hello non-nested named baz route layout | ||
| </div> | ||
| <Outlet /> | ||
| </div> | ||
| ) | ||
| } |
19 changes: 19 additions & 0 deletions
19
e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/named/$baz_/bar')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-named-baz-bar-heading"> | ||
| Hello non-nested named bar | ||
| </div> | ||
| <div data-testid="non-nested-named-baz-bar-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
58 changes: 58 additions & 0 deletions
58
e2e/react-router/basic-file-based/src/routes/non-nested/named/route.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { Link, Outlet, createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/named')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-named-root-route-heading"> | ||
| Hello non-nested named layout | ||
| </div> | ||
| <div> | ||
| <Link | ||
| from={Route.fullPath} | ||
| to="./$baz" | ||
| params={{ baz: 'baz' }} | ||
| data-testid="to-named-index" | ||
| > | ||
| To named index | ||
| </Link> | ||
| <Link | ||
| from={Route.fullPath} | ||
| to="./$baz/foo" | ||
| params={{ baz: 'baz' }} | ||
| data-testid="to-named-foo" | ||
| > | ||
| To named foo | ||
| </Link> | ||
| <Link | ||
| from={Route.fullPath} | ||
| to="./$baz/foo" | ||
| params={{ baz: 'baz_' }} | ||
| data-testid="to-named-foo-2" | ||
| > | ||
| To named foo 2 | ||
| </Link> | ||
| <Link | ||
| from={Route.fullPath} | ||
| to="./$baz/bar" | ||
| params={{ baz: 'baz' }} | ||
| data-testid="to-named-bar" | ||
| > | ||
| To named bar | ||
| </Link> | ||
| <Link | ||
| from={Route.fullPath} | ||
| to="./$baz/bar" | ||
| params={{ baz: 'baz_' }} | ||
| data-testid="to-named-bar-2" | ||
| > | ||
| To named bar 2 | ||
| </Link> | ||
| </div> | ||
| <Outlet /> | ||
| </div> | ||
| ) | ||
| } |
20 changes: 20 additions & 0 deletions
20
e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/path/baz/foo')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
|
|
||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-path-baz-foo-heading"> | ||
| Hello nested path baz foo page | ||
| </div> | ||
| <div data-testid="non-nested-path-baz-foo-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
19 changes: 19 additions & 0 deletions
19
e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/path/baz/')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-path-baz-index-heading"> | ||
| Hello nested path baz index | ||
| </div> | ||
| <div data-testid="non-nested-path-baz-index-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
16 changes: 16 additions & 0 deletions
16
e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Outlet, createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/path/baz')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-path-baz-route-heading"> | ||
| Hello non-nested path baz route layout | ||
| </div> | ||
| <Outlet /> | ||
| </div> | ||
| ) | ||
| } |
19 changes: 19 additions & 0 deletions
19
e2e/react-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/path/baz_/bar')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-path-baz-bar-heading"> | ||
| Hello non-nested path bar | ||
| </div> | ||
| <div data-testid="non-nested-path-baz-bar-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
33 changes: 33 additions & 0 deletions
33
e2e/react-router/basic-file-based/src/routes/non-nested/path/route.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { Link, Outlet, createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/path')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-path-root-route-heading"> | ||
| Hello non-nested path layout | ||
| </div> | ||
| <div> | ||
| <Link from={Route.fullPath} to="./baz" data-testid="to-path-index"> | ||
| To path index | ||
| </Link> | ||
| <Link from={Route.fullPath} to="./baz/foo" data-testid="to-path-foo"> | ||
| To path foo | ||
| </Link> | ||
| <Link from={Route.fullPath} to="./baz/foo" data-testid="to-path-foo-2"> | ||
| To path foo 2 | ||
| </Link> | ||
| <Link from={Route.fullPath} to="./baz/bar" data-testid="to-path-bar"> | ||
| To path bar | ||
| </Link> | ||
| <Link from={Route.fullPath} to="./baz/bar" data-testid="to-path-bar-2"> | ||
| To path bar 2 | ||
| </Link> | ||
| </div> | ||
| <Outlet /> | ||
| </div> | ||
| ) | ||
| } |
20 changes: 20 additions & 0 deletions
20
e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/foo')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
|
|
||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-prefix-baz-foo-heading"> | ||
| Hello nested prefix foo page | ||
| </div> | ||
| <div data-testid="non-nested-prefix-baz-foo-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
19 changes: 19 additions & 0 deletions
19
e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-prefix-baz-index-heading"> | ||
| Hello nested prefix index | ||
| </div> | ||
| <div data-testid="non-nested-prefix-baz-index-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
16 changes: 16 additions & 0 deletions
16
e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Outlet, createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-prefix-baz-route-heading"> | ||
| Hello non-nested prefix route layout | ||
| </div> | ||
| <Outlet /> | ||
| </div> | ||
| ) | ||
| } |
19 changes: 19 additions & 0 deletions
19
e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}_/bar')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const params = Route.useParams() | ||
| return ( | ||
| <div> | ||
| <div data-testid="non-nested-prefix-baz-bar-heading"> | ||
| Hello non-nested wildcard bar | ||
| </div> | ||
| <div data-testid="non-nested-prefix-baz-bar-param"> | ||
| {JSON.stringify(params)} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.