Repository: TanStack/router
Pull request #2401 (2024-09-23 18:52:40)

Add test cases for route id consistency
#2400 

schiller-manuel: can you please add a test for this?
nx-cloud[bot]: # ☁️ Nx Cloud Report

CI is running for commit d31f4522f70f0c32dc5e599938e65b6d71773e0b.

[📂 Click to track the progress, see the status, the terminal output, and the build insights.](https://cloud.nx.app/cipes/66f1d1c77e5a5c483f2251f6?utm_source=pull-request&utm_medium=comment)


---

Sent with 💌 from [NxCloud.](https://nx.app?utm_source=pull-request&utm_medium=comment)
pkg-pr-new[bot]: 
[Open in Stackblitz](https://pkg.pr.new/template/156941db-acd3-4c79-8da4-f51397442259)
<details><summary><b>More templates</b></summary><p>

- [tanstack-router-react-example-authenticated-routes](https://pkg.pr.new/template/a0851f25-a95e-42e0-881d-84746e88331e)
- [tanstack-router-react-example-basic](https://pkg.pr.new/template/9ce0d793-f4bf-4722-9fb6-b16ef35cba4b)
- [tanstack-router-react-example-basic-default-search-params](https://pkg.pr.new/template/fc29cf60-d911-46fd-b6b9-f6588cd2d547)
- [tanstack-router-react-example-basic-file-based](https://pkg.pr.new/template/555ead4c-d500-4a85-af48-8ac933d0413d)
- [tanstack-router-react-example-basic-file-based-codesplitting](https://pkg.pr.new/template/632f2726-c62b-40e9-a5cd-f391ba431ae2)
- [tanstack-router-react-example-react-query](https://pkg.pr.new/template/f94e4b0b-aaf0-4d83-aabb-f872c6ec667f)
- [tanstack-router-react-example-basic-react-query-file-based](https://pkg.pr.new/template/d85ddb77-306c-4fdd-9d3c-947a53c8c6fa)
- [tanstack-router-react-example-basic-ssr-file-based](https://pkg.pr.new/template/2c97305b-b494-4271-b999-c3eb86bf5dd7)
- [tanstack-router-react-example-basic-ssr-streaming-file-based](https://pkg.pr.new/template/75ee13ab-1fb2-464f-92cd-1d57f58f9618)
- [tanstack-router-react-example-basic-virtual-file-based](https://pkg.pr.new/template/c26cad30-4215-4e50-bf5c-71697d67ac85)
- [tanstack-router-react-example-basic-virtual-inside-file-based](https://pkg.pr.new/template/5a5d8333-1d85-4f06-8d72-70e5a76fe662)
- [tanstack-router-react-example-deferred-data](https://pkg.pr.new/template/99b2e689-307c-4efc-8019-9b0e458c7da1)
- [tanstack-router-react-example-kitchen-sink](https://pkg.pr.new/template/bc371cf4-0fc1-4f5c-9b49-43d6074da479)
- [tanstack-router-react-example-kitchen-sink-file-based](https://pkg.pr.new/template/af198d9d-6bab-4797-b207-4375a3cc58ad)
- [tanstack-router-react-example-kitchen-sink-react-query](https://pkg.pr.new/template/3fa2ba4f-8ef8-45b5-9a1b-dbd83629182b)
- [tanstack-router-react-example-kitchen-sink-react-query-file-based](https://pkg.pr.new/template/c2be7bca-0258-44fc-92c1-c62d6e178343)
- [tanstack-router-react-example-large-file-based](https://pkg.pr.new/template/ce15b1f1-614a-4dbb-abe7-0c8da44e7c73)
- [tanstack-router-react-example-location-masking](https://pkg.pr.new/template/44c8673f-cad2-4405-bcea-a122655cc810)
- [tanstack-router-react-example-navigation-blocking](https://pkg.pr.new/template/fda71d16-c496-43ef-9f38-ae51aaf0fa91)
- [tanstack-router-react-example-quickstart](https://pkg.pr.new/template/795bab0c-7ef3-4f4a-b39c-b16f85799102)
- [tanstack-router-react-example-quickstart-file-based](https://pkg.pr.new/template/21e51344-ee23-4869-afed-e663204623d5)
- [tanstack-router-react-example-quickstart-rspack-file-based](https://pkg.pr.new/template/51d9a358-c61e-4de3-a019-7c523950a3f3)
- [tanstack-router-react-example-quickstart-webpack-file-based](https://pkg.pr.new/template/ae08abac-d839-4c58-8acd-e787553a03e8)
- [tanstack-router-react-example-scroll-restoration](https://pkg.pr.new/template/c37a6b4f-d6a7-4722-851f-6c21e498680a)
- [tanstack-router-search-validator-adapters](https://pkg.pr.new/template/663fb00f-30ad-4e8d-bc19-cc36d8f82de0)
- [tanstack-start-example-basic](https://pkg.pr.new/template/1698a591-ce2c-4d9b-8f00-04b6d7551023)
- [tanstack-start-example-basic-auth](https://pkg.pr.new/template/b5cc2206-e89a-4e68-8f8c-5b80aa5e5998)
- [tanstack-start-example-basic-react-query](https://pkg.pr.new/template/bae08446-5ef6-456e-a1a0-422d6be14562)
- [tanstack-start-example-basic-rsc](https://pkg.pr.new/template/4ce8e542-5ba1-4622-99df-0c71fc72ae91)
- [tanstack-start-example-convex-trellaux](https://pkg.pr.new/template/dad24e7f-3724-4132-935b-238bf52af72e)
- [tanstack-start-example-clerk-basic](https://pkg.pr.new/template/241d9c20-9751-4ecc-aea9-16fd3cc5dc53)
- [tanstack-start-example-counter](https://pkg.pr.new/template/592c8f34-571f-4e2e-bdfe-1fd932dcd156)
- [tanstack-start-example-supabase-basic](https://pkg.pr.new/template/726e8663-4323-46aa-a252-2a6fc4573d19)
- [tanstack-start-example-trellaux](https://pkg.pr.new/template/d3a3b5e2-a606-451b-997a-e6a3302e6813)
- [tanstack-router-react-example-with-framer-motion](https://pkg.pr.new/template/6894f60b-919a-4002-a556-18e2abfd4d49)
- [tanstack-router-react-example-with-trpc](https://pkg.pr.new/template/aa2fba03-d22d-4fac-92f9-685553066b13)
- [tanstack-router-react-example-with-trpc-react-query](https://pkg.pr.new/template/023e34bd-99a7-4d62-bec4-1b35111b1c9b)

</p></details>
      
    


<details><summary><b>@tanstack/create-router</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/create-router@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/eslint-plugin-router</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-router@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/history</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/history@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/react-cross-context</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/react-cross-context@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/react-router</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/react-router@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/react-router-with-query</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/react-router-with-query@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/router-arktype-adapter</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/router-arktype-adapter@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/router-cli</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/router-cli@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/router-devtools</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/router-devtools@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/router-generator</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/router-generator@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/router-valibot-adapter</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/router-valibot-adapter@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/router-plugin</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/router-plugin@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/router-vite-plugin</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/router-vite-plugin@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/router-zod-adapter</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/router-zod-adapter@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/start</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/start@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/start-vite-plugin</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/start-vite-plugin@2401
```

</p></details>
      
    

<details><summary><b>@tanstack/virtual-file-routes</b></summary><p>

```
pnpm add https://pkg.pr.new/@tanstack/virtual-file-routes@2401
```

</p></details>
      
    

_commit: <a href="https://github.com/TanStack/router/runs/30548135580"><code>d31f452</code></a>_

stevenlyd: > can you please add a test for this?

No problem, I'll do it later today. Actually I found this fix won't work for lazy pathless routes, since they don't have path, will always use `options.id` as fallback. I guess the key is to make sure the `option.id` we use when generating `customId` doesn't contain any parent prefix. I'm thinking about adding a util function to trim the parent prefix, what do you think?
stevenlyd: @schiller-manuel 
Good afternoon! I've updated my fix and added test cases.
The root issue is we need to trim parent prefix when generating lazy routes (using either `createLazyRoute` or `createLazyFileRoute`). 
So that  it won't mess things up after the `id` in the lazy route object got assigned back to the primary route object,
stevenlyd: @schiller-manuel I've extracted test cases for route id consistency. All other changes have been reverted, since a simpler fix is already been implemented.

Patch:
diff --git a/docs/framework/react/api/router/retainSearchParams.md b/docs/framework/react/api/router/retainSearchParams.md
index 474c03182..b0ac8175d 100644
--- a/docs/framework/react/api/router/retainSearchParams.md
+++ b/docs/framework/react/api/router/retainSearchParams.md
@@ -7,9 +7,10 @@ title: Search middleware to retain search params
 
 ## retainSearchParams props
 
-The `retainSearchParams` accepts a list of keys of those search params that shall be retained.
+The `retainSearchParams` either accepts `true` or a list of keys of those search params that shall be retained.
+If `true` is passed in, all search params will be retained.
 
-## Example
+## Examples
 
 ```tsx
 import { z } from 'zod'
@@ -27,3 +28,21 @@ export const Route = createRootRoute({
   },
 })
 ```
+
+```tsx
+import { z } from 'zod'
+import { createFileRoute } from '@tanstack/react-router'
+import { zodSearchValidator } from '@tanstack/router-zod-adapter'
+
+const searchSchema = z.object({
+  one: z.string().optional(),
+  two: z.string().optional(),
+})
+
+export const Route = createFileRoute('/hello')({
+  validateSearch: zodSearchValidator(searchSchema),
+  search: {
+    middlewares: [retainSearchParams(true)],
+  },
+})
+```
diff --git a/examples/react/authenticated-routes/package.json b/examples/react/authenticated-routes/package.json
index 8a41b648a..406e0e967 100644
--- a/examples/react/authenticated-routes/package.json
+++ b/examples/react/authenticated-routes/package.json
@@ -9,9 +9,9 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/basic-default-search-params/package.json b/examples/react/basic-default-search-params/package.json
index eeff05d0b..3372b7966 100644
--- a/examples/react/basic-default-search-params/package.json
+++ b/examples/react/basic-default-search-params/package.json
@@ -10,8 +10,8 @@
   },
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "redaxios": "^0.5.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic-file-based-codesplitting/package.json b/examples/react/basic-file-based-codesplitting/package.json
index 512a01222..0b80c2e24 100644
--- a/examples/react/basic-file-based-codesplitting/package.json
+++ b/examples/react/basic-file-based-codesplitting/package.json
@@ -9,9 +9,9 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/basic-file-based/package.json b/examples/react/basic-file-based/package.json
index e10bcc0d0..34a539196 100644
--- a/examples/react/basic-file-based/package.json
+++ b/examples/react/basic-file-based/package.json
@@ -9,9 +9,9 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/basic-react-query-file-based/package.json b/examples/react/basic-react-query-file-based/package.json
index 3902438a8..9749756a9 100644
--- a/examples/react/basic-react-query-file-based/package.json
+++ b/examples/react/basic-react-query-file-based/package.json
@@ -11,9 +11,9 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
     "@tanstack/react-query-devtools": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/basic-react-query/package.json b/examples/react/basic-react-query/package.json
index 7763e452e..4bcf15ec3 100644
--- a/examples/react/basic-react-query/package.json
+++ b/examples/react/basic-react-query/package.json
@@ -11,8 +11,8 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
     "@tanstack/react-query-devtools": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1"
diff --git a/examples/react/basic-ssr-file-based/package.json b/examples/react/basic-ssr-file-based/package.json
index d216677fb..0b9588ee7 100644
--- a/examples/react/basic-ssr-file-based/package.json
+++ b/examples/react/basic-ssr-file-based/package.json
@@ -11,10 +11,10 @@
     "debug": "node --inspect-brk server"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "get-port": "^7.1.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic-ssr-streaming-file-based/package.json b/examples/react/basic-ssr-streaming-file-based/package.json
index 999c08809..17e887bff 100644
--- a/examples/react/basic-ssr-streaming-file-based/package.json
+++ b/examples/react/basic-ssr-streaming-file-based/package.json
@@ -11,10 +11,10 @@
     "debug": "node --inspect-brk server"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "get-port": "^7.1.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic-virtual-file-based/package.json b/examples/react/basic-virtual-file-based/package.json
index eccf317be..9f2904990 100644
--- a/examples/react/basic-virtual-file-based/package.json
+++ b/examples/react/basic-virtual-file-based/package.json
@@ -9,9 +9,9 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "@tanstack/virtual-file-routes": "^1.64.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic-virtual-inside-file-based/package.json b/examples/react/basic-virtual-inside-file-based/package.json
index f87c124f8..468f501b5 100644
--- a/examples/react/basic-virtual-inside-file-based/package.json
+++ b/examples/react/basic-virtual-inside-file-based/package.json
@@ -9,9 +9,9 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "@tanstack/virtual-file-routes": "^1.64.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic/package.json b/examples/react/basic/package.json
index 3534bbc14..58bf61100 100644
--- a/examples/react/basic/package.json
+++ b/examples/react/basic/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1"
diff --git a/examples/react/deferred-data/package.json b/examples/react/deferred-data/package.json
index 2966813aa..39ee3d05a 100644
--- a/examples/react/deferred-data/package.json
+++ b/examples/react/deferred-data/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "redaxios": "^0.5.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/kitchen-sink-file-based/package.json b/examples/react/kitchen-sink-file-based/package.json
index 8194a4ae2..96f3758ba 100644
--- a/examples/react/kitchen-sink-file-based/package.json
+++ b/examples/react/kitchen-sink-file-based/package.json
@@ -9,9 +9,9 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "immer": "^10.1.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/kitchen-sink-react-query-file-based/package.json b/examples/react/kitchen-sink-react-query-file-based/package.json
index 9342d18ec..c837a6b37 100644
--- a/examples/react/kitchen-sink-react-query-file-based/package.json
+++ b/examples/react/kitchen-sink-react-query-file-based/package.json
@@ -11,9 +11,9 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
     "@tanstack/react-query-devtools": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "immer": "^10.1.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/kitchen-sink-react-query/package.json b/examples/react/kitchen-sink-react-query/package.json
index 2efdb0b21..99d124e90 100644
--- a/examples/react/kitchen-sink-react-query/package.json
+++ b/examples/react/kitchen-sink-react-query/package.json
@@ -11,8 +11,8 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
     "@tanstack/react-query-devtools": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "redaxios": "^0.5.1",
     "immer": "^10.1.1",
     "react": "^18.2.0",
diff --git a/examples/react/kitchen-sink/package.json b/examples/react/kitchen-sink/package.json
index 313896fa9..96a5642ca 100644
--- a/examples/react/kitchen-sink/package.json
+++ b/examples/react/kitchen-sink/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "redaxios": "^0.5.1",
     "immer": "^10.1.1",
     "react": "^18.2.0",
diff --git a/examples/react/large-file-based/package.json b/examples/react/large-file-based/package.json
index ce2dcca75..e26d9a759 100644
--- a/examples/react/large-file-based/package.json
+++ b/examples/react/large-file-based/package.json
@@ -12,9 +12,9 @@
   },
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/location-masking/package.json b/examples/react/location-masking/package.json
index dadfbc3fc..653fe4826 100644
--- a/examples/react/location-masking/package.json
+++ b/examples/react/location-masking/package.json
@@ -11,8 +11,8 @@
   "dependencies": {
     "@radix-ui/react-dialog": "^1.1.2",
     "@tanstack/react-query": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "redaxios": "^0.5.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0"
diff --git a/examples/react/navigation-blocking/package.json b/examples/react/navigation-blocking/package.json
index 48187b231..dc5211cc1 100644
--- a/examples/react/navigation-blocking/package.json
+++ b/examples/react/navigation-blocking/package.json
@@ -10,8 +10,8 @@
   },
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "redaxios": "^0.5.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0"
diff --git a/examples/react/quickstart-file-based/package.json b/examples/react/quickstart-file-based/package.json
index b521f4dc5..979293b96 100644
--- a/examples/react/quickstart-file-based/package.json
+++ b/examples/react/quickstart-file-based/package.json
@@ -9,9 +9,9 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/quickstart-rspack-file-based/package.json b/examples/react/quickstart-rspack-file-based/package.json
index bbcc9dec6..8b2fb1199 100644
--- a/examples/react/quickstart-rspack-file-based/package.json
+++ b/examples/react/quickstart-rspack-file-based/package.json
@@ -8,15 +8,15 @@
     "preview": "rsbuild preview"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "react": "^18.3.1",
     "react-dom": "^18.3.1"
   },
   "devDependencies": {
     "@rsbuild/core": "1.0.13",
     "@rsbuild/plugin-react": "1.0.3",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "@types/react": "^18.3.3",
     "@types/react-dom": "^18.3.0",
     "typescript": "^5.6.2"
diff --git a/examples/react/quickstart-webpack-file-based/package.json b/examples/react/quickstart-webpack-file-based/package.json
index 591134544..1ad795aed 100644
--- a/examples/react/quickstart-webpack-file-based/package.json
+++ b/examples/react/quickstart-webpack-file-based/package.json
@@ -7,14 +7,14 @@
     "build": "webpack build && tsc --noEmit"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "react": "^18.3.1",
     "react-dom": "^18.3.1"
   },
   "devDependencies": {
     "@swc/core": "^1.7.35",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "@types/react": "^18.3.3",
     "@types/react-dom": "^18.3.0",
     "html-webpack-plugin": "^5.6.0",
diff --git a/examples/react/quickstart/package.json b/examples/react/quickstart/package.json
index 398752498..e88bcbc80 100644
--- a/examples/react/quickstart/package.json
+++ b/examples/react/quickstart/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0"
   },
diff --git a/examples/react/scroll-restoration/package.json b/examples/react/scroll-restoration/package.json
index 7489ef652..bcd050c06 100644
--- a/examples/react/scroll-restoration/package.json
+++ b/examples/react/scroll-restoration/package.json
@@ -9,9 +9,9 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
     "@tanstack/react-virtual": "^3.10.8",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/router-devtools": "^1.69.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0"
   },
diff --git a/examples/react/search-validator-adapters/package.json b/examples/react/search-validator-adapters/package.json
index 879a52431..d1da305d1 100644
--- a/examples/react/search-validator-adapters/package.json
+++ b/examples/react/search-validator-adapters/package.json
@@ -10,12 +10,12 @@
   },
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-arktype-adapter": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
-    "@tanstack/router-valibot-adapter": "^1.67.0",
-    "@tanstack/router-zod-adapter": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-arktype-adapter": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
+    "@tanstack/router-valibot-adapter": "^1.69.1",
+    "@tanstack/router-zod-adapter": "^1.69.1",
     "arktype": "^2.0.0-rc.15",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/start-basic-auth/package.json b/examples/react/start-basic-auth/package.json
index b9e41f731..fe0bfb253 100644
--- a/examples/react/start-basic-auth/package.json
+++ b/examples/react/start-basic-auth/package.json
@@ -11,9 +11,9 @@
   },
   "dependencies": {
     "@prisma/client": "5.20.0",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "dotenv": "^16.4.5",
     "prisma": "^5.20.0",
     "react": "^18.3.1",
diff --git a/examples/react/start-basic-react-query/package.json b/examples/react/start-basic-react-query/package.json
index 469daa682..ddecac112 100644
--- a/examples/react/start-basic-react-query/package.json
+++ b/examples/react/start-basic-react-query/package.json
@@ -11,10 +11,10 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
     "@tanstack/react-query-devtools": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/react-router-with-query": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/react-router-with-query": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "react": "^18.3.1",
     "react-dom": "^18.3.1",
     "redaxios": "^0.5.1",
diff --git a/examples/react/start-basic-rsc/package.json b/examples/react/start-basic-rsc/package.json
index 72a7bf911..eb8c1ba74 100644
--- a/examples/react/start-basic-rsc/package.json
+++ b/examples/react/start-basic-rsc/package.json
@@ -10,9 +10,9 @@
   },
   "dependencies": {
     "@babel/plugin-syntax-typescript": "^7.25.7",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "redaxios": "^0.5.1",
     "tailwind-merge": "^2.5.3",
     "vinxi": "0.4.3"
diff --git a/examples/react/start-basic/package.json b/examples/react/start-basic/package.json
index 6b9822f9c..5a46e0c69 100644
--- a/examples/react/start-basic/package.json
+++ b/examples/react/start-basic/package.json
@@ -9,9 +9,9 @@
     "start": "vinxi start"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "react": "^18.3.1",
     "react-dom": "^18.3.1",
     "redaxios": "^0.5.1",
diff --git a/examples/react/start-clerk-basic/package.json b/examples/react/start-clerk-basic/package.json
index f0bbc6077..a60bbf129 100644
--- a/examples/react/start-clerk-basic/package.json
+++ b/examples/react/start-clerk-basic/package.json
@@ -10,9 +10,9 @@
   },
   "dependencies": {
     "@clerk/tanstack-start": "0.4.12",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "dotenv": "^16.4.5",
     "react": "^18.3.1",
     "react-dom": "^18.3.1",
diff --git a/examples/react/start-convex-trellaux/package.json b/examples/react/start-convex-trellaux/package.json
index 8b1c41b53..a14b3b5ec 100644
--- a/examples/react/start-convex-trellaux/package.json
+++ b/examples/react/start-convex-trellaux/package.json
@@ -13,10 +13,10 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
     "@tanstack/react-query-devtools": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/react-router-with-query": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/react-router-with-query": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "@convex-dev/react-query": "0.0.0-alpha.5",
     "concurrently": "^8.2.2",
     "convex": "^1.16.5",
diff --git a/examples/react/start-counter/package.json b/examples/react/start-counter/package.json
index a254c1bdb..fda774ba7 100644
--- a/examples/react/start-counter/package.json
+++ b/examples/react/start-counter/package.json
@@ -9,8 +9,8 @@
     "start": "vinxi start"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "react": "^18.3.1",
     "react-dom": "^18.3.1",
     "vinxi": "0.4.3"
diff --git a/examples/react/start-supabase-basic/package.json b/examples/react/start-supabase-basic/package.json
index 4cf6534ac..b7ac17d48 100644
--- a/examples/react/start-supabase-basic/package.json
+++ b/examples/react/start-supabase-basic/package.json
@@ -15,9 +15,9 @@
   "dependencies": {
     "@supabase/ssr": "^0.5.1",
     "@supabase/supabase-js": "^2.45.4",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "@vitejs/plugin-react": "^4.3.2",
     "react": "^18.3.1",
     "react-dom": "^18.3.1",
diff --git a/examples/react/start-trellaux/package.json b/examples/react/start-trellaux/package.json
index 898c8795c..26d9b54ca 100644
--- a/examples/react/start-trellaux/package.json
+++ b/examples/react/start-trellaux/package.json
@@ -11,10 +11,10 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
     "@tanstack/react-query-devtools": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/react-router-with-query": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/start": "^1.68.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/react-router-with-query": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/start": "^1.69.1",
     "ky": "^1.7.2",
     "msw": "^2.4.11",
     "react": "^18.3.1",
diff --git a/examples/react/with-framer-motion/package.json b/examples/react/with-framer-motion/package.json
index 9638cb977..e1a7b39a5 100644
--- a/examples/react/with-framer-motion/package.json
+++ b/examples/react/with-framer-motion/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
     "redaxios": "^0.5.1",
     "framer-motion": "^11.11.8",
     "react": "^18.2.0",
diff --git a/examples/react/with-trpc-react-query/package.json b/examples/react/with-trpc-react-query/package.json
index fb6141e87..8bcaba5c1 100644
--- a/examples/react/with-trpc-react-query/package.json
+++ b/examples/react/with-trpc-react-query/package.json
@@ -10,9 +10,9 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.13",
     "@tanstack/react-query-devtools": "^5.59.13",
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "@trpc/client": "11.0.0-rc.571",
     "@trpc/react-query": "11.0.0-rc.571",
     "@trpc/server": "11.0.0-rc.571",
diff --git a/examples/react/with-trpc/package.json b/examples/react/with-trpc/package.json
index 8345fdda2..1306e66a2 100644
--- a/examples/react/with-trpc/package.json
+++ b/examples/react/with-trpc/package.json
@@ -8,9 +8,9 @@
     "start": "vinxi start"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.67.0",
-    "@tanstack/router-devtools": "^1.67.0",
-    "@tanstack/router-plugin": "^1.66.1",
+    "@tanstack/react-router": "^1.69.1",
+    "@tanstack/router-devtools": "^1.69.1",
+    "@tanstack/router-plugin": "^1.69.1",
     "@trpc/client": "11.0.0-rc.571",
     "@trpc/server": "11.0.0-rc.571",
     "react": "^18.2.0",
diff --git a/packages/create-router/package.json b/packages/create-router/package.json
index b27ea986c..2f65d0f19 100644
--- a/packages/create-router/package.json
+++ b/packages/create-router/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/create-router",
-  "version": "1.67.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/react-router-with-query/package.json b/packages/react-router-with-query/package.json
index 4b3bb1cf8..c4e404d9f 100644
--- a/packages/react-router-with-query/package.json
+++ b/packages/react-router-with-query/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/react-router-with-query",
-  "version": "1.67.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/react-router/package.json b/packages/react-router/package.json
index fb0c8e159..81df6ce1b 100644
--- a/packages/react-router/package.json
+++ b/packages/react-router/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/react-router",
-  "version": "1.67.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/react-router/src/fileRoute.ts b/packages/react-router/src/fileRoute.ts
index e84814b41..8962278a0 100644
--- a/packages/react-router/src/fileRoute.ts
+++ b/packages/react-router/src/fileRoute.ts
@@ -265,16 +265,9 @@ export function createLazyRoute<
   }
 }
 
-const routeGroupPatternRegex = /\(.+\)/g
-
-function removeGroups(s: string) {
-  return s.replaceAll(routeGroupPatternRegex, '').replaceAll('//', '/')
-}
-
 export function createLazyFileRoute<
   TFilePath extends keyof FileRoutesByPath,
   TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],
 >(id: TFilePath) {
-  return (opts: LazyRouteOptions) =>
-    new LazyRoute<TRoute>({ id: removeGroups(id), ...opts })
+  return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })
 }
diff --git a/packages/react-router/src/searchMiddleware.ts b/packages/react-router/src/searchMiddleware.ts
index 7d561e7a6..dd0720a6a 100644
--- a/packages/react-router/src/searchMiddleware.ts
+++ b/packages/react-router/src/searchMiddleware.ts
@@ -1,10 +1,13 @@
 import type { SearchMiddleware } from './route'
 
 export function retainSearchParams<TSearchSchema extends object>(
-  keys: Array<keyof TSearchSchema>,
+  keys: Array<keyof TSearchSchema> | true,
 ): SearchMiddleware<TSearchSchema> {
   return ({ search, next }) => {
     const result = next(search)
+    if (keys === true) {
+      return { ...search, ...result }
+    }
     // add missing keys from search to result
     keys.forEach((key) => {
       if (!(key in result)) {
diff --git a/packages/router-arktype-adapter/package.json b/packages/router-arktype-adapter/package.json
index cfb7356b3..bb3799b5e 100644
--- a/packages/router-arktype-adapter/package.json
+++ b/packages/router-arktype-adapter/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-arktype-adapter",
-  "version": "1.67.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/router-cli/package.json b/packages/router-cli/package.json
index 9e217706e..bfe5bb0ce 100644
--- a/packages/router-cli/package.json
+++ b/packages/router-cli/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-cli",
-  "version": "1.65.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/router-devtools/package.json b/packages/router-devtools/package.json
index 971f1aa4c..d36d04277 100644
--- a/packages/router-devtools/package.json
+++ b/packages/router-devtools/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-devtools",
-  "version": "1.67.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/router-generator/package.json b/packages/router-generator/package.json
index 8d7328373..d7781f1fc 100644
--- a/packages/router-generator/package.json
+++ b/packages/router-generator/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-generator",
-  "version": "1.65.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/router-generator/src/generator.ts b/packages/router-generator/src/generator.ts
index 1fbd17943..87fe699fc 100644
--- a/packages/router-generator/src/generator.ts
+++ b/packages/router-generator/src/generator.ts
@@ -591,12 +591,10 @@ export const Route = createAPIFileRoute('${escapedRoutePath}')({
   interface FileRoutesByPath {
     ${routeNodes
       .map((routeNode) => {
-        const [filePathId, routeId] = getFilePathIdAndRouteIdFromPath(
-          routeNode.routePath,
-        )
+        const filePathId = getFilePathIdFromPath(routeNode.routePath)
 
         return `'${filePathId}': {
-          id: '${routeId}'
+          id: '${filePathId}'
           path: '${inferPath(routeNode)}'
           fullPath: '${inferFullPath(routeNode)}'
           preLoaderRoute: typeof ${routeNode.variableName}Import
@@ -661,24 +659,21 @@ export const Route = createAPIFileRoute('${escapedRoutePath}')({
     const routesManifest = {
       __root__: {
         filePath: rootRouteNode.filePath,
-        children: routeTree.map(
-          (d) => getFilePathIdAndRouteIdFromPath(d.routePath)[1],
-        ),
+        children: routeTree.map((d) => getFilePathIdFromPath(d.routePath)),
       },
       ...Object.fromEntries(
         routeNodes.map((d) => {
-          const [_, routeId] = getFilePathIdAndRouteIdFromPath(d.routePath)
+          const filePathId = getFilePathIdFromPath(d.routePath)
 
           return [
-            routeId,
+            filePathId,
             {
               filePath: d.filePath,
               parent: d.parent?.routePath
-                ? getFilePathIdAndRouteIdFromPath(d.parent.routePath)[1]
+                ? getFilePathIdFromPath(d.parent.routePath)
                 : undefined,
-              children: d.children?.map(
-                (childRoute) =>
-                  getFilePathIdAndRouteIdFromPath(childRoute.routePath)[1],
+              children: d.children?.map((childRoute) =>
+                getFilePathIdFromPath(childRoute.routePath),
               ),
             },
           ]
@@ -749,12 +744,6 @@ export const Route = createAPIFileRoute('${escapedRoutePath}')({
   )
 }
 
-function spaces(d: number): string {
-  return Array.from({ length: d })
-    .map(() => ' ')
-    .join('')
-}
-
 function removeTrailingUnderscores(s?: string) {
   return s?.replaceAll(/(_$)/gi, '').replaceAll(/(_\/)/gi, '/')
 }
@@ -879,7 +868,7 @@ export const createRouteNodesById = (
 ): Map<string, RouteNode> => {
   return new Map(
     routeNodes.map((routeNode) => {
-      const [_, id] = getFilePathIdAndRouteIdFromPath(routeNode.routePath)
+      const id = getFilePathIdFromPath(routeNode.routePath)
       return [id, routeNode]
     }),
   )
@@ -928,11 +917,9 @@ export const dedupeBranchesAndIndexRoutes = (
   })
 }
 
-function getFilePathIdAndRouteIdFromPath(pathname?: string) {
+function getFilePathIdFromPath(pathname?: string) {
   const filePathId = removeTrailingUnderscores(pathname)
-  const id = removeGroups(filePathId ?? '')
-
-  return [filePathId, id] as const
+  return filePathId ?? ''
 }
 
 function checkUnique<TElement>(routes: Array<TElement>, key: keyof TElement) {
diff --git a/packages/router-plugin/package.json b/packages/router-plugin/package.json
index 3665d03c1..a6971912c 100644
--- a/packages/router-plugin/package.json
+++ b/packages/router-plugin/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-plugin",
-  "version": "1.66.1",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/router-valibot-adapter/package.json b/packages/router-valibot-adapter/package.json
index b80de6037..3136b3dfe 100644
--- a/packages/router-valibot-adapter/package.json
+++ b/packages/router-valibot-adapter/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-valibot-adapter",
-  "version": "1.67.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/router-vite-plugin/package.json b/packages/router-vite-plugin/package.json
index d3a9318f5..4bd1afd31 100644
--- a/packages/router-vite-plugin/package.json
+++ b/packages/router-vite-plugin/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-vite-plugin",
-  "version": "1.66.1",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/router-zod-adapter/package.json b/packages/router-zod-adapter/package.json
index 82cb3e616..9fa26df74 100644
--- a/packages/router-zod-adapter/package.json
+++ b/packages/router-zod-adapter/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-zod-adapter",
-  "version": "1.67.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/start/package.json b/packages/start/package.json
index 4f999fd85..1a01883ef 100644
--- a/packages/start/package.json
+++ b/packages/start/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start",
-  "version": "1.68.0",
+  "version": "1.69.1",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8f41f62f8..89cbb17b9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -157,6 +157,9 @@ importers:
       '@tanstack/router-plugin':
         specifier: workspace:*
         version: link:../../../packages/router-plugin
+      '@tanstack/router-zod-adapter':
+        specifier: workspace:*
+        version: link:../../../packages/router-zod-adapter
       react:
         specifier: ^18.2.0
         version: 18.3.1
@@ -1575,10 +1578,10 @@ importers:
         version: 18.3.0
       html-webpack-plugin:
         specifier: ^5.6.0
-        version: 5.6.0(@rspack/core@1.0.10(@swc/helpers@0.5.13))(webpack@5.95.0)
+        version: 5.6.0(@rspack/core@1.0.10(@swc/helpers@0.5.13))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
       swc-loader:
         specifier: ^0.2.6
-        version: 0.2.6(@swc/core@1.7.35(@swc/helpers@0.5.13))(webpack@5.95.0)
+        version: 0.2.6(@swc/core@1.7.35(@swc/helpers@0.5.13))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
       typescript:
         specifier: ^5.6.2
         version: 5.6.2
@@ -2378,7 +2381,7 @@ importers:
         version: 4.3.2(vite@5.4.8(@types/node@22.7.4)(terser@5.31.1))
       html-webpack-plugin:
         specifier: ^5.6.0
-        version: 5.6.0(@rspack/core@1.0.10(@swc/helpers@0.5.13))(webpack@5.95.0)
+        version: 5.6.0(@rspack/core@1.0.10(@swc/helpers@0.5.13))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
       react:
         specifier: ^18.3.1
         version: 18.3.1
@@ -2387,7 +2390,7 @@ importers:
         version: 18.3.1(react@18.3.1)
       swc-loader:
         specifier: ^0.2.6
-        version: 0.2.6(@swc/core@1.7.35(@swc/helpers@0.5.13))(webpack@5.95.0)
+        version: 0.2.6(@swc/core@1.7.35(@swc/helpers@0.5.13))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
       typescript:
         specifier: ^5.6.2
         version: 5.6.2
@@ -12456,17 +12459,17 @@ snapshots:
       '@webassemblyjs/ast': 1.12.1
       '@xtuc/long': 4.2.2
 
-  '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4)(webpack@5.95.0)':
+  '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))':
     dependencies:
       webpack: 5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)
       webpack-cli: 5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0)
 
-  '@webpack-cli/info@2.0.2(webpack-cli@5.1.4)(webpack@5.95.0)':
+  '@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))':
     dependencies:
       webpack: 5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)
       webpack-cli: 5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0)
 
-  '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4)(webpack-dev-server@5.1.0)(webpack@5.95.0)':
+  '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack-dev-server@5.1.0(webpack-cli@5.1.4)(webpack@5.95.0))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))':
     dependencies:
       webpack: 5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)
       webpack-cli: 5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0)
@@ -14412,7 +14415,7 @@ snapshots:
 
   html-void-elements@3.0.0: {}
 
-  html-webpack-plugin@5.6.0(@rspack/core@1.0.10(@swc/helpers@0.5.13))(webpack@5.95.0):
+  html-webpack-plugin@5.6.0(@rspack/core@1.0.10(@swc/helpers@0.5.13))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)):
     dependencies:
       '@types/html-minifier-terser': 6.1.0
       html-minifier-terser: 6.1.0
@@ -16560,7 +16563,7 @@ snapshots:
       csso: 5.0.5
       picocolors: 1.1.0
 
-  swc-loader@0.2.6(@swc/core@1.7.35(@swc/helpers@0.5.13))(webpack@5.95.0):
+  swc-loader@0.2.6(@swc/core@1.7.35(@swc/helpers@0.5.13))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)):
     dependencies:
       '@swc/core': 1.7.35(@swc/helpers@0.5.13)
       '@swc/counter': 0.1.3
@@ -16630,26 +16633,26 @@ snapshots:
       mkdirp: 1.0.4
       yallist: 4.0.0
 
-  terser-webpack-plugin@5.3.10(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)):
+  terser-webpack-plugin@5.3.10(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)):
     dependencies:
       '@jridgewell/trace-mapping': 0.3.25
       jest-worker: 27.5.1
       schema-utils: 3.3.0
       serialize-javascript: 6.0.2
       terser: 5.31.1
-      webpack: 5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)
+      webpack: 5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)
     optionalDependencies:
       '@swc/core': 1.7.35(@swc/helpers@0.5.13)
       esbuild: 0.23.1
 
-  terser-webpack-plugin@5.3.10(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack@5.95.0):
+  terser-webpack-plugin@5.3.10(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)):
     dependencies:
       '@jridgewell/trace-mapping': 0.3.25
       jest-worker: 27.5.1
       schema-utils: 3.3.0
       serialize-javascript: 6.0.2
       terser: 5.31.1
-      webpack: 5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)
+      webpack: 5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)
     optionalDependencies:
       '@swc/core': 1.7.35(@swc/helpers@0.5.13)
       esbuild: 0.23.1
@@ -17293,9 +17296,9 @@ snapshots:
   webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0):
     dependencies:
       '@discoveryjs/json-ext': 0.5.7
-      '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4)(webpack@5.95.0)
-      '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4)(webpack@5.95.0)
-      '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4)(webpack-dev-server@5.1.0)(webpack@5.95.0)
+      '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
+      '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
+      '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack-dev-server@5.1.0(webpack-cli@5.1.4)(webpack@5.95.0))(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
       colorette: 2.0.20
       commander: 10.0.1
       cross-spawn: 7.0.3
@@ -17309,7 +17312,7 @@ snapshots:
     optionalDependencies:
       webpack-dev-server: 5.1.0(webpack-cli@5.1.4)(webpack@5.95.0)
 
-  webpack-dev-middleware@7.4.2(webpack@5.95.0):
+  webpack-dev-middleware@7.4.2(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)):
     dependencies:
       colorette: 2.0.20
       memfs: 4.9.3
@@ -17348,7 +17351,7 @@ snapshots:
       serve-index: 1.9.1
       sockjs: 0.3.24
       spdy: 4.0.2
-      webpack-dev-middleware: 7.4.2(webpack@5.95.0)
+      webpack-dev-middleware: 7.4.2(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
       ws: 8.18.0
     optionalDependencies:
       webpack: 5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4)
@@ -17421,7 +17424,7 @@ snapshots:
       neo-async: 2.6.2
       schema-utils: 3.3.0
       tapable: 2.2.1
-      terser-webpack-plugin: 5.3.10(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack@5.95.0)
+      terser-webpack-plugin: 5.3.10(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack@5.95.0(@swc/core@1.7.35(@swc/helpers@0.5.13))(esbuild@0.23.1)(webpack-cli@5.1.4))
       watchpack: 2.4.1
       webpack-sources: 3.2.3
     optionalDependencies:


Test patch:
diff --git a/e2e/react-router/basic-file-based/package.json b/e2e/react-router/basic-file-based/package.json
index 2cdf96845..9422d90bb 100644
--- a/e2e/react-router/basic-file-based/package.json
+++ b/e2e/react-router/basic-file-based/package.json
@@ -13,6 +13,7 @@
     "@tanstack/react-router": "workspace:^",
     "@tanstack/router-devtools": "workspace:^",
     "@tanstack/router-plugin": "workspace:^",
+    "@tanstack/router-zod-adapter": "workspace:^",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
     "redaxios": "^0.5.1",
diff --git a/e2e/react-router/basic-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-file-based/src/routeTree.gen.ts
index 149df203a..095f3f661 100644
--- a/e2e/react-router/basic-file-based/src/routeTree.gen.ts
+++ b/e2e/react-router/basic-file-based/src/routeTree.gen.ts
@@ -8,6 +8,8 @@
 
 // This file is auto-generated by TanStack Router
 
+import { createFileRoute } from '@tanstack/react-router'
+
 // Import Routes
 
 import { Route as rootRoute } from './routes/__root'
@@ -17,11 +19,23 @@ import { Route as IndexImport } from './routes/index'
 import { Route as PostsIndexImport } from './routes/posts.index'
 import { Route as PostsPostIdImport } from './routes/posts.$postId'
 import { Route as LayoutLayout2Import } from './routes/_layout/_layout-2'
+import { Route as groupLazyinsideImport } from './routes/(group)/lazyinside'
+import { Route as groupLayoutImport } from './routes/(group)/_layout'
 import { Route as LayoutLayout2LayoutBImport } from './routes/_layout/_layout-2/layout-b'
 import { Route as LayoutLayout2LayoutAImport } from './routes/_layout/_layout-2/layout-a'
+import { Route as groupLayoutInsideImport } from './routes/(group)/_layout.inside'
+
+// Create Virtual Routes
+
+const groupImport = createFileRoute('/(group)')()
 
 // Create/Update Routes
 
+const groupRoute = groupImport.update({
+  id: '/(group)',
+  getParentRoute: () => rootRoute,
+} as any)
+
 const PostsRoute = PostsImport.update({
   path: '/posts',
   getParentRoute: () => rootRoute,
@@ -52,6 +66,18 @@ const LayoutLayout2Route = LayoutLayout2Import.update({
   getParentRoute: () => LayoutRoute,
 } as any)
 
+const groupLazyinsideRoute = groupLazyinsideImport
+  .update({
+    path: '/lazyinside',
+    getParentRoute: () => groupRoute,
+  } as any)
+  .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route))
+
+const groupLayoutRoute = groupLayoutImport.update({
+  id: '/_layout',
+  getParentRoute: () => groupRoute,
+} as any)
+
 const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBImport.update({
   path: '/layout-b',
   getParentRoute: () => LayoutLayout2Route,
@@ -62,6 +88,11 @@ const LayoutLayout2LayoutARoute = LayoutLayout2LayoutAImport.update({
   getParentRoute: () => LayoutLayout2Route,
 } as any)
 
+const groupLayoutInsideRoute = groupLayoutInsideImport.update({
+  path: '/inside',
+  getParentRoute: () => groupLayoutRoute,
+} as any)
+
 // Populate the FileRoutesByPath interface
 
 declare module '@tanstack/react-router' {
@@ -87,6 +118,27 @@ declare module '@tanstack/react-router' {
       preLoaderRoute: typeof PostsImport
       parentRoute: typeof rootRoute
     }
+    '/(group)': {
+      id: '/(group)'
+      path: '/'
+      fullPath: '/'
+      preLoaderRoute: typeof groupImport
+      parentRoute: typeof rootRoute
+    }
+    '/(group)/_layout': {
+      id: '/(group)/_layout'
+      path: '/'
+      fullPath: '/'
+      preLoaderRoute: typeof groupLayoutImport
+      parentRoute: typeof groupRoute
+    }
+    '/(group)/lazyinside': {
+      id: '/(group)/lazyinside'
+      path: '/lazyinside'
+      fullPath: '/lazyinside'
+      preLoaderRoute: typeof groupLazyinsideImport
+      parentRoute: typeof groupImport
+    }
     '/_layout/_layout-2': {
       id: '/_layout/_layout-2'
       path: ''
@@ -108,6 +160,13 @@ declare module '@tanstack/react-router' {
       preLoaderRoute: typeof PostsIndexImport
       parentRoute: typeof PostsImport
     }
+    '/(group)/_layout/inside': {
+      id: '/(group)/_layout/inside'
+      path: '/inside'
+      fullPath: '/inside'
+      preLoaderRoute: typeof groupLayoutInsideImport
+      parentRoute: typeof groupLayoutImport
+    }
     '/_layout/_layout-2/layout-a': {
       id: '/_layout/_layout-2/layout-a'
       path: '/layout-a'
@@ -164,21 +223,49 @@ const PostsRouteChildren: PostsRouteChildren = {
 
 const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)
 
+interface groupLayoutRouteChildren {
+  groupLayoutInsideRoute: typeof groupLayoutInsideRoute
+}
+
+const groupLayoutRouteChildren: groupLayoutRouteChildren = {
+  groupLayoutInsideRoute: groupLayoutInsideRoute,
+}
+
+const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(
+  groupLayoutRouteChildren,
+)
+
+interface groupRouteChildren {
+  groupLayoutRoute: typeof groupLayoutRouteWithChildren
+  groupLazyinsideRoute: typeof groupLazyinsideRoute
+}
+
+const groupRouteChildren: groupRouteChildren = {
+  groupLayoutRoute: groupLayoutRouteWithChildren,
+  groupLazyinsideRoute: groupLazyinsideRoute,
+}
+
+const groupRouteWithChildren = groupRoute._addFileChildren(groupRouteChildren)
+
 export interface FileRoutesByFullPath {
-  '/': typeof IndexRoute
+  '/': typeof groupLayoutRouteWithChildren
   '': typeof LayoutLayout2RouteWithChildren
   '/posts': typeof PostsRouteWithChildren
+  '/lazyinside': typeof groupLazyinsideRoute
   '/posts/$postId': typeof PostsPostIdRoute
   '/posts/': typeof PostsIndexRoute
+  '/inside': typeof groupLayoutInsideRoute
   '/layout-a': typeof LayoutLayout2LayoutARoute
   '/layout-b': typeof LayoutLayout2LayoutBRoute
 }
 
 export interface FileRoutesByTo {
-  '/': typeof IndexRoute
+  '/': typeof groupLayoutRouteWithChildren
   '': typeof LayoutLayout2RouteWithChildren
+  '/lazyinside': typeof groupLazyinsideRoute
   '/posts/$postId': typeof PostsPostIdRoute
   '/posts': typeof PostsIndexRoute
+  '/inside': typeof groupLayoutInsideRoute
   '/layout-a': typeof LayoutLayout2LayoutARoute
   '/layout-b': typeof LayoutLayout2LayoutBRoute
 }
@@ -188,9 +275,13 @@ export interface FileRoutesById {
   '/': typeof IndexRoute
   '/_layout': typeof LayoutRouteWithChildren
   '/posts': typeof PostsRouteWithChildren
+  '/(group)': typeof groupRouteWithChildren
+  '/(group)/_layout': typeof groupLayoutRouteWithChildren
+  '/(group)/lazyinside': typeof groupLazyinsideRoute
   '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren
   '/posts/$postId': typeof PostsPostIdRoute
   '/posts/': typeof PostsIndexRoute
+  '/(group)/_layout/inside': typeof groupLayoutInsideRoute
   '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute
   '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute
 }
@@ -201,20 +292,34 @@ export interface FileRouteTypes {
     | '/'
     | ''
     | '/posts'
+    | '/lazyinside'
     | '/posts/$postId'
     | '/posts/'
+    | '/inside'
     | '/layout-a'
     | '/layout-b'
   fileRoutesByTo: FileRoutesByTo
-  to: '/' | '' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'
+  to:
+    | '/'
+    | ''
+    | '/lazyinside'
+    | '/posts/$postId'
+    | '/posts'
+    | '/inside'
+    | '/layout-a'
+    | '/layout-b'
   id:
     | '__root__'
     | '/'
     | '/_layout'
     | '/posts'
+    | '/(group)'
+    | '/(group)/_layout'
+    | '/(group)/lazyinside'
     | '/_layout/_layout-2'
     | '/posts/$postId'
     | '/posts/'
+    | '/(group)/_layout/inside'
     | '/_layout/_layout-2/layout-a'
     | '/_layout/_layout-2/layout-b'
   fileRoutesById: FileRoutesById
@@ -224,12 +329,14 @@ export interface RootRouteChildren {
   IndexRoute: typeof IndexRoute
   LayoutRoute: typeof LayoutRouteWithChildren
   PostsRoute: typeof PostsRouteWithChildren
+  groupRoute: typeof groupRouteWithChildren
 }
 
 const rootRouteChildren: RootRouteChildren = {
   IndexRoute: IndexRoute,
   LayoutRoute: LayoutRouteWithChildren,
   PostsRoute: PostsRouteWithChildren,
+  groupRoute: groupRouteWithChildren,
 }
 
 export const routeTree = rootRoute
@@ -246,7 +353,8 @@ export const routeTree = rootRoute
       "children": [
         "/",
         "/_layout",
-        "/posts"
+        "/posts",
+        "/(group)"
       ]
     },
     "/": {
@@ -265,6 +373,24 @@ export const routeTree = rootRoute
         "/posts/"
       ]
     },
+    "/(group)": {
+      "filePath": "(group)",
+      "children": [
+        "/(group)/_layout",
+        "/(group)/lazyinside"
+      ]
+    },
+    "/(group)/_layout": {
+      "filePath": "(group)/_layout.tsx",
+      "parent": "/(group)",
+      "children": [
+        "/(group)/_layout/inside"
+      ]
+    },
+    "/(group)/lazyinside": {
+      "filePath": "(group)/lazyinside.tsx",
+      "parent": "/(group)"
+    },
     "/_layout/_layout-2": {
       "filePath": "_layout/_layout-2.tsx",
       "parent": "/_layout",
@@ -281,6 +407,10 @@ export const routeTree = rootRoute
       "filePath": "posts.index.tsx",
       "parent": "/posts"
     },
+    "/(group)/_layout/inside": {
+      "filePath": "(group)/_layout.inside.tsx",
+      "parent": "/(group)/_layout"
+    },
     "/_layout/_layout-2/layout-a": {
       "filePath": "_layout/_layout-2/layout-a.tsx",
       "parent": "/_layout/_layout-2"
diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/_layout.inside.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/_layout.inside.tsx
new file mode 100644
index 000000000..d8984fc63
--- /dev/null
+++ b/e2e/react-router/basic-file-based/src/routes/(group)/_layout.inside.tsx
@@ -0,0 +1,21 @@
+import { createFileRoute, useSearch } from '@tanstack/react-router'
+import { z } from 'zod'
+import { zodSearchValidator } from '@tanstack/router-zod-adapter'
+
+export const Route = createFileRoute('/(group)/_layout/inside')({
+  validateSearch: zodSearchValidator(
+    z.object({ hello: z.string().optional() }),
+  ),
+  component: () => {
+    const searchViaHook = useSearch({ from: '/(group)/_layout/inside' })
+    const searchViaRouteHook = Route.useSearch()
+    return (
+      <>
+        <div data-testid="search-via-hook">{searchViaHook.hello}</div>
+        <div data-testid="search-via-route-hook">
+          {searchViaRouteHook.hello}
+        </div>
+      </>
+    )
+  },
+})
diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/_layout.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/_layout.tsx
new file mode 100644
index 000000000..4b755791c
--- /dev/null
+++ b/e2e/react-router/basic-file-based/src/routes/(group)/_layout.tsx
@@ -0,0 +1,10 @@
+import { Outlet, createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(group)/_layout')({
+  component: () => (
+    <>
+      <div>/(group)/_layout!</div>
+      <Outlet />
+    </>
+  ),
+})
diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx
new file mode 100644
index 000000000..43240278f
--- /dev/null
+++ b/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx
@@ -0,0 +1,16 @@
+import { createLazyFileRoute, useSearch } from '@tanstack/react-router'
+
+export const Route = createLazyFileRoute('/(group)/lazyinside')({
+  component: () => {
+    const searchViaHook = useSearch({ from: '/(group)/lazyinside' })
+    const searchViaRouteHook = Route.useSearch()
+    return (
+      <>
+        <div data-testid="search-via-hook">{searchViaHook.hello}</div>
+        <div data-testid="search-via-route-hook">
+          {searchViaRouteHook.hello}
+        </div>
+      </>
+    )
+  },
+})
diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.tsx
new file mode 100644
index 000000000..d0803ef20
--- /dev/null
+++ b/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { z } from 'zod'
+import { zodSearchValidator } from '@tanstack/router-zod-adapter'
+
+export const Route = createFileRoute('/(group)/lazyinside')({
+  validateSearch: zodSearchValidator(
+    z.object({ hello: z.string().optional() }),
+  ),
+})
diff --git a/e2e/react-router/basic-file-based/src/routes/__root.tsx b/e2e/react-router/basic-file-based/src/routes/__root.tsx
index 6b57d1e23..2499f017b 100644
--- a/e2e/react-router/basic-file-based/src/routes/__root.tsx
+++ b/e2e/react-router/basic-file-based/src/routes/__root.tsx
@@ -43,6 +43,26 @@ function RootComponent() {
         >
           Layout
         </Link>{' '}
+        <Link
+          to="/inside"
+          data-testid="link-to-route-inside-group"
+          search={{ hello: 'world' }}
+          activeProps={{
+            className: 'font-bold',
+          }}
+        >
+          Inside Group
+        </Link>{' '}
+        <Link
+          to="/lazyinside"
+          data-testid="link-to-lazy-route-inside-group"
+          search={{ hello: 'world' }}
+          activeProps={{
+            className: 'font-bold',
+          }}
+        >
+          Lazy Inside Group
+        </Link>{' '}
         <Link
           // @ts-expect-error
           to="/this-route-does-not-exist"
diff --git a/e2e/react-router/basic-file-based/tests/app.spec.ts b/e2e/react-router/basic-file-based/tests/app.spec.ts
index f19a88b56..8d1e9110d 100644
--- a/e2e/react-router/basic-file-based/tests/app.spec.ts
+++ b/e2e/react-router/basic-file-based/tests/app.spec.ts
@@ -32,3 +32,15 @@ test('Navigating to a not-found route', async ({ page }) => {
   await page.getByRole('link', { name: 'Start Over' }).click()
   await expect(page.getByRole('heading')).toContainText('Welcome Home!')
 })
+
+test('Navigating to a route inside a route group', async ({ page }) => {
+  await page.getByTestId('link-to-route-inside-group').click()
+  await expect(page.getByTestId('search-via-hook')).toContainText('world')
+  await expect(page.getByTestId('search-via-route-hook')).toContainText('world')
+})
+
+test('Navigating to a lazy route inside a route group', async ({ page }) => {
+  await page.getByTestId('link-to-lazy-route-inside-group').click()
+  await expect(page.getByTestId('search-via-hook')).toContainText('world')
+  await expect(page.getByTestId('search-via-route-hook')).toContainText('world')
+})
diff --git a/e2e/react-router/basic-file-based/tsconfig.json b/e2e/react-router/basic-file-based/tsconfig.json
index c9e17e2b6..b50d8070e 100644
--- a/e2e/react-router/basic-file-based/tsconfig.json
+++ b/e2e/react-router/basic-file-based/tsconfig.json
@@ -2,6 +2,7 @@
   "compilerOptions": {
     "strict": true,
     "esModuleInterop": true,
-    "jsx": "react-jsx"
+    "jsx": "react-jsx",
+    "skipLibCheck": true
   }
 }
diff --git a/packages/react-router/tests/lazy/normal.tsx b/packages/react-router/tests/lazy/normal.tsx
new file mode 100644
index 000000000..1addf96c7
--- /dev/null
+++ b/packages/react-router/tests/lazy/normal.tsx
@@ -0,0 +1,13 @@
+import { createLazyFileRoute, createLazyRoute } from '../../src'
+
+export function Route(id: string) {
+  return createLazyRoute(id)({
+    component: () => <h1>I'm a normal route</h1>,
+  })
+}
+
+export function FileRoute(id: string) {
+  return createLazyFileRoute(id as any)({
+    component: () => <h1>I'm a normal file route</h1>,
+  })
+}
diff --git a/packages/react-router/tests/router.test.tsx b/packages/react-router/tests/router.test.tsx
index 5ec04873d..d9fe6585c 100644
--- a/packages/react-router/tests/router.test.tsx
+++ b/packages/react-router/tests/router.test.tsx
@@ -73,6 +73,54 @@ function createTestRouter(initialHistory?: RouterHistory) {
     getParentRoute: () => pathSegmentLayoutSplatRoute,
     path: '$',
   })
+  const protectedRoute = createRoute({
+    getParentRoute: () => rootRoute,
+    id: '/_protected',
+  }).lazy(() => import('./lazy/normal').then((f) => f.Route('/_protected')))
+  const protectedLayoutRoute = createRoute({
+    getParentRoute: () => protectedRoute,
+    id: '/_layout',
+  }).lazy(() =>
+    import('./lazy/normal').then((f) => f.Route('/_protected/_layout')),
+  )
+  const protectedFileBasedLayoutRoute = createRoute({
+    getParentRoute: () => protectedRoute,
+    id: '/_fileBasedLayout',
+  }).lazy(() =>
+    import('./lazy/normal').then((f) =>
+      f.FileRoute('/_protected/_fileBasedLayout'),
+    ),
+  )
+  const protectedFileBasedLayoutParentRoute = createRoute({
+    getParentRoute: () => protectedFileBasedLayoutRoute,
+    path: '/fileBasedParent',
+  }).lazy(() =>
+    import('./lazy/normal').then((f) =>
+      f.FileRoute('/_protected/_fileBasedLayout/fileBasedParent'),
+    ),
+  )
+  const protectedLayoutParentRoute = createRoute({
+    getParentRoute: () => protectedLayoutRoute,
+    path: '/parent',
+  }).lazy(() =>
+    import('./lazy/normal').then((f) => f.Route('/_protected/_layout/parent')),
+  )
+  const protectedLayoutParentChildRoute = createRoute({
+    getParentRoute: () => protectedLayoutParentRoute,
+    path: '/child',
+  }).lazy(() =>
+    import('./lazy/normal').then((f) =>
+      f.Route('/_protected/_layout/parent/child'),
+    ),
+  )
+  const protectedFileBasedLayoutParentChildRoute = createRoute({
+    getParentRoute: () => protectedFileBasedLayoutParentRoute,
+    path: '/child',
+  }).lazy(() =>
+    import('./lazy/normal').then((f) =>
+      f.FileRoute('/_protected/_fileBasedLayout/fileBasedParent/child'),
+    ),
+  )
 
   const routeTree = rootRoute.addChildren([
     indexRoute,
@@ -85,6 +133,18 @@ function createTestRouter(initialHistory?: RouterHistory) {
       pathSegmentLayoutSplatIndexRoute,
       pathSegmentLayoutSplatSplatRoute,
     ]),
+    protectedRoute.addChildren([
+      protectedLayoutRoute.addChildren([
+        protectedLayoutParentRoute.addChildren([
+          protectedLayoutParentChildRoute,
+        ]),
+      ]),
+      protectedFileBasedLayoutRoute.addChildren([
+        protectedFileBasedLayoutParentRoute.addChildren([
+          protectedFileBasedLayoutParentChildRoute,
+        ]),
+      ]),
+    ]),
   ])
 
   const router = createRouter({ routeTree, history })
@@ -606,3 +666,77 @@ describe('invalidate', () => {
     })
   })
 })
+
+describe('route ids should be consistent after rebuilding the route tree', () => {
+  it('should have the same route ids after rebuilding the route tree', async () => {
+    const { router } = createTestRouter(
+      createMemoryHistory({ initialEntries: ['/'] }),
+    )
+
+    const originalRouteIds = Object.keys(router.routesById)
+
+    await act(() =>
+      router.navigate({
+        to: '/parent/child',
+      }),
+    )
+
+    await act(() =>
+      router.navigate({
+        to: '/filBasedParent/child',
+      }),
+    )
+
+    router.buildRouteTree()
+
+    const rebuiltRouteIds = Object.keys(router.routesById)
+
+    originalRouteIds.forEach((id) => {
+      expect(rebuiltRouteIds).toContain(id)
+    })
+
+    rebuiltRouteIds.forEach((id) => {
+      expect(originalRouteIds).toContain(id)
+    })
+  })
+})
+
+describe('route id uniqueness', () => {
+  it('flatRoute should not have routes with duplicated route ids', () => {
+    const { router } = createTestRouter(
+      createMemoryHistory({ initialEntries: ['/'] }),
+    )
+    const routeIdSet = new Set<string>()
+
+    router.flatRoutes.forEach((route) => {
+      expect(routeIdSet.has(route.id)).toBe(false)
+      routeIdSet.add(route.id)
+    })
+  })
+
+  it('routesById should not have routes duplicated route ids', () => {
+    const { router } = createTestRouter(
+      createMemoryHistory({ initialEntries: ['/'] }),
+    )
+
+    const routeIdSet = new Set<string>()
+
+    Object.values(router.routesById).forEach((route) => {
+      expect(routeIdSet.has(route.id)).toBe(false)
+      routeIdSet.add(route.id)
+    })
+  })
+
+  it('routesByPath should not have routes duplicated route ids', () => {
+    const { router } = createTestRouter(
+      createMemoryHistory({ initialEntries: ['/'] }),
+    )
+
+    const routeIdSet = new Set<string>()
+
+    Object.values(router.routesByPath).forEach((route) => {
+      expect(routeIdSet.has(route.id)).toBe(false)
+      routeIdSet.add(route.id)
+    })
+  })
+})
diff --git a/packages/router-generator/tests/generator/file-modification/routeTree.snapshot.ts b/packages/router-generator/tests/generator/file-modification/routeTree.snapshot.ts
index 9e8e4be5c..6df9c95e8 100644
--- a/packages/router-generator/tests/generator/file-modification/routeTree.snapshot.ts
+++ b/packages/router-generator/tests/generator/file-modification/routeTree.snapshot.ts
@@ -54,28 +54,28 @@ const testFooRoute = testFooImport.update({
 declare module '@tanstack/react-router' {
   interface FileRoutesByPath {
     '/(test)/foo': {
-      id: '/foo'
+      id: '/(test)/foo'
       path: '/foo'
       fullPath: '/foo'
       preLoaderRoute: typeof testFooImport
       parentRoute: typeof rootRoute
     }
     '/(test)/initiallyEmpty': {
-      id: '/initiallyEmpty'
+      id: '/(test)/initiallyEmpty'
       path: '/initiallyEmpty'
       fullPath: '/initiallyEmpty'
       preLoaderRoute: typeof testInitiallyEmptyImport
       parentRoute: typeof rootRoute
     }
     '/(test)/initiallyLazy': {
-      id: '/initiallyLazy'
+      id: '/(test)/initiallyLazy'
       path: '/initiallyLazy'
       fullPath: '/initiallyLazy'
       preLoaderRoute: typeof testInitiallyLazyImport
       parentRoute: typeof rootRoute
     }
     '/(test)/bar': {
-      id: '/bar'
+      id: '/(test)/bar'
       path: '/bar'
       fullPath: '/bar'
       preLoaderRoute: typeof testBarLazyImport
@@ -102,10 +102,10 @@ export interface FileRoutesByTo {
 
 export interface FileRoutesById {
   __root__: typeof rootRoute
-  '/foo': typeof testFooRoute
-  '/initiallyEmpty': typeof testInitiallyEmptyRoute
-  '/initiallyLazy': typeof testInitiallyLazyRoute
-  '/bar': typeof testBarLazyRoute
+  '/(test)/foo': typeof testFooRoute
+  '/(test)/initiallyEmpty': typeof testInitiallyEmptyRoute
+  '/(test)/initiallyLazy': typeof testInitiallyLazyRoute
+  '/(test)/bar': typeof testBarLazyRoute
 }
 
 export interface FileRouteTypes {
@@ -113,7 +113,12 @@ export interface FileRouteTypes {
   fullPaths: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar'
   fileRoutesByTo: FileRoutesByTo
   to: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar'
-  id: '__root__' | '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar'
+  id:
+    | '__root__'
+    | '/(test)/foo'
+    | '/(test)/initiallyEmpty'
+    | '/(test)/initiallyLazy'
+    | '/(test)/bar'
   fileRoutesById: FileRoutesById
 }
 
@@ -143,22 +148,22 @@ export const routeTree = rootRoute
     "__root__": {
       "filePath": "__root.tsx",
       "children": [
-        "/foo",
-        "/initiallyEmpty",
-        "/initiallyLazy",
-        "/bar"
+        "/(test)/foo",
+        "/(test)/initiallyEmpty",
+        "/(test)/initiallyLazy",
+        "/(test)/bar"
       ]
     },
-    "/foo": {
+    "/(test)/foo": {
       "filePath": "(test)/foo.tsx"
     },
-    "/initiallyEmpty": {
+    "/(test)/initiallyEmpty": {
       "filePath": "(test)/initiallyEmpty.tsx"
     },
-    "/initiallyLazy": {
+    "/(test)/initiallyLazy": {
       "filePath": "(test)/initiallyLazy.tsx"
     },
-    "/bar": {
+    "/(test)/bar": {
       "filePath": "(test)/bar.lazy.tsx"
     }
   }
diff --git a/packages/router-generator/tests/generator/nested-layouts/routeTree.snapshot.ts b/packages/router-generator/tests/generator/nested-layouts/routeTree.snapshot.ts
index a41c906e0..c4dc705bb 100644
--- a/packages/router-generator/tests/generator/nested-layouts/routeTree.snapshot.ts
+++ b/packages/router-generator/tests/generator/nested-layouts/routeTree.snapshot.ts
@@ -216,7 +216,7 @@ declare module '@tanstack/react-router' {
       parentRoute: typeof FooRoute
     }
     '/(folder)/in-folder': {
-      id: '/in-folder'
+      id: '/(folder)/in-folder'
       path: '/in-folder'
       fullPath: '/in-folder'
       preLoaderRoute: typeof folderInFolderImport
@@ -552,7 +552,7 @@ export interface FileRoutesById {
   '/_layout-a2': typeof LayoutA2RouteWithChildren
   '/foo': typeof FooRouteWithChildren
   '/foo/_layout-b5': typeof FooLayoutB5RouteRouteWithChildren
-  '/in-folder': typeof folderInFolderRoute
+  '/(folder)/in-folder': typeof folderInFolderRoute
   '/_layout-a1/foo': typeof LayoutA1FooRoute
   '/_layout-a2/bar': typeof LayoutA2BarRoute
   '/foo/bar': typeof FooBarRoute
@@ -615,7 +615,7 @@ export interface FileRouteTypes {
     | '/_layout-a2'
     | '/foo'
     | '/foo/_layout-b5'
-    | '/in-folder'
+    | '/(folder)/in-folder'
     | '/_layout-a1/foo'
     | '/_layout-a2/bar'
     | '/foo/bar'
@@ -674,7 +674,7 @@ export const routeTree = rootRoute
         "/_layout-a1",
         "/_layout-a2",
         "/foo",
-        "/in-folder",
+        "/(folder)/in-folder",
         "/nested"
       ]
     },
@@ -715,7 +715,7 @@ export const routeTree = rootRoute
         "/foo/_layout-b5/"
       ]
     },
-    "/in-folder": {
+    "/(folder)/in-folder": {
       "filePath": "(folder)/in-folder.tsx"
     },
     "/_layout-a1/foo": {
diff --git a/packages/router-generator/tests/generator/route-groups/_layout.tsx b/packages/router-generator/tests/generator/route-groups/_layout.tsx
new file mode 100644
index 000000000..4654553db
--- /dev/null
+++ b/packages/router-generator/tests/generator/route-groups/_layout.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(foo)/asdf/(bar)/_layout')({
+  component: () => <div>Hello /(foo)/asdf/(bar)/_layout!</div>,
+})
diff --git a/packages/router-generator/tests/generator/route-groups/routeTree.snapshot.ts b/packages/router-generator/tests/generator/route-groups/routeTree.snapshot.ts
index 06d86ac02..f3e568e93 100644
--- a/packages/router-generator/tests/generator/route-groups/routeTree.snapshot.ts
+++ b/packages/router-generator/tests/generator/route-groups/routeTree.snapshot.ts
@@ -8,62 +8,278 @@
 
 // This file is auto-generated by TanStack Router
 
+import { createFileRoute } from '@tanstack/react-router'
+
 // Import Routes
 
 import { Route as rootRoute } from './routes/__root'
+import { Route as fooAsdfLayoutImport } from './routes/(foo)/asdf/_layout'
+import { Route as fooAsdfLayoutFooImport } from './routes/(foo)/asdf/_layout.foo'
 import { Route as fooAsdfbarIdImport } from './routes/(foo)/asdf/(bar)/$id'
+import { Route as fooAsdfanotherGroupLayoutImport } from './routes/(foo)/asdf/(another-group)/_layout'
+import { Route as fooAsdfbarLayoutAboutImport } from './routes/(foo)/asdf/(bar)/_layout.about'
+import { Route as fooAsdfanotherGroupLayoutBazImport } from './routes/(foo)/asdf/(another-group)/_layout.baz'
+
+// Create Virtual Routes
+
+const fooAsdfImport = createFileRoute('/(foo)/asdf')()
+const fooAsdfanotherGroupImport = createFileRoute(
+  '/(foo)/asdf/(another-group)',
+)()
+const fooAsdfbarLayoutXyzLazyImport = createFileRoute(
+  '/(foo)/asdf/(bar)/_layout/xyz',
+)()
 
 // Create/Update Routes
 
-const fooAsdfbarIdRoute = fooAsdfbarIdImport.update({
-  path: '/asdf/$id',
+const fooAsdfRoute = fooAsdfImport.update({
+  path: '/asdf',
   getParentRoute: () => rootRoute,
 } as any)
 
+const fooAsdfanotherGroupRoute = fooAsdfanotherGroupImport.update({
+  id: '/(another-group)',
+  getParentRoute: () => fooAsdfRoute,
+} as any)
+
+const fooAsdfLayoutRoute = fooAsdfLayoutImport.update({
+  id: '/_layout',
+  getParentRoute: () => fooAsdfRoute,
+} as any)
+
+const fooAsdfLayoutFooRoute = fooAsdfLayoutFooImport.update({
+  path: '/foo',
+  getParentRoute: () => fooAsdfLayoutRoute,
+} as any)
+
+const fooAsdfbarIdRoute = fooAsdfbarIdImport.update({
+  path: '/$id',
+  getParentRoute: () => fooAsdfRoute,
+} as any)
+
+const fooAsdfanotherGroupLayoutRoute = fooAsdfanotherGroupLayoutImport.update({
+  id: '/_layout',
+  getParentRoute: () => fooAsdfanotherGroupRoute,
+} as any)
+
+const fooAsdfbarLayoutXyzLazyRoute = fooAsdfbarLayoutXyzLazyImport
+  .update({
+    path: '/xyz',
+    getParentRoute: () => fooAsdfRoute,
+  } as any)
+  .lazy(() =>
+    import('./routes/(foo)/asdf/(bar)/_layout.xyz.lazy').then((d) => d.Route),
+  )
+
+const fooAsdfbarLayoutAboutRoute = fooAsdfbarLayoutAboutImport.update({
+  path: '/about',
+  getParentRoute: () => fooAsdfRoute,
+} as any)
+
+const fooAsdfanotherGroupLayoutBazRoute =
+  fooAsdfanotherGroupLayoutBazImport.update({
+    path: '/baz',
+    getParentRoute: () => fooAsdfanotherGroupLayoutRoute,
+  } as any)
+
 // Populate the FileRoutesByPath interface
 
 declare module '@tanstack/react-router' {
   interface FileRoutesByPath {
+    '/(foo)/asdf': {
+      id: '/(foo)/asdf'
+      path: '/asdf'
+      fullPath: '/asdf'
+      preLoaderRoute: typeof fooAsdfImport
+      parentRoute: typeof rootRoute
+    }
+    '/(foo)/asdf/_layout': {
+      id: '/(foo)/asdf/_layout'
+      path: '/asdf'
+      fullPath: '/asdf'
+      preLoaderRoute: typeof fooAsdfLayoutImport
+      parentRoute: typeof fooAsdfRoute
+    }
+    '/(foo)/asdf/(another-group)': {
+      id: '/(foo)/asdf/(another-group)'
+      path: '/'
+      fullPath: '/asdf/'
+      preLoaderRoute: typeof fooAsdfanotherGroupImport
+      parentRoute: typeof fooAsdfImport
+    }
+    '/(foo)/asdf/(another-group)/_layout': {
+      id: '/(foo)/asdf/(another-group)/_layout'
+      path: '/'
+      fullPath: '/asdf/'
+      preLoaderRoute: typeof fooAsdfanotherGroupLayoutImport
+      parentRoute: typeof fooAsdfanotherGroupRoute
+    }
     '/(foo)/asdf/(bar)/$id': {
-      id: '/asdf/$id'
-      path: '/asdf/$id'
+      id: '/(foo)/asdf/(bar)/$id'
+      path: '/$id'
       fullPath: '/asdf/$id'
       preLoaderRoute: typeof fooAsdfbarIdImport
-      parentRoute: typeof rootRoute
+      parentRoute: typeof fooAsdfImport
+    }
+    '/(foo)/asdf/_layout/foo': {
+      id: '/(foo)/asdf/_layout/foo'
+      path: '/foo'
+      fullPath: '/asdf/foo'
+      preLoaderRoute: typeof fooAsdfLayoutFooImport
+      parentRoute: typeof fooAsdfLayoutImport
+    }
+    '/(foo)/asdf/(another-group)/_layout/baz': {
+      id: '/(foo)/asdf/(another-group)/_layout/baz'
+      path: '/baz'
+      fullPath: '/asdf/baz'
+      preLoaderRoute: typeof fooAsdfanotherGroupLayoutBazImport
+      parentRoute: typeof fooAsdfanotherGroupLayoutImport
+    }
+    '/(foo)/asdf/(bar)/_layout/about': {
+      id: '/(foo)/asdf/(bar)/_layout/about'
+      path: '/about'
+      fullPath: '/asdf/about'
+      preLoaderRoute: typeof fooAsdfbarLayoutAboutImport
+      parentRoute: typeof fooAsdfImport
+    }
+    '/(foo)/asdf/(bar)/_layout/xyz': {
+      id: '/(foo)/asdf/(bar)/_layout/xyz'
+      path: '/xyz'
+      fullPath: '/asdf/xyz'
+      preLoaderRoute: typeof fooAsdfbarLayoutXyzLazyImport
+      parentRoute: typeof fooAsdfImport
     }
   }
 }
 
 // Create and export the route tree
 
+interface fooAsdfLayoutRouteChildren {
+  fooAsdfLayoutFooRoute: typeof fooAsdfLayoutFooRoute
+}
+
+const fooAsdfLayoutRouteChildren: fooAsdfLayoutRouteChildren = {
+  fooAsdfLayoutFooRoute: fooAsdfLayoutFooRoute,
+}
+
+const fooAsdfLayoutRouteWithChildren = fooAsdfLayoutRoute._addFileChildren(
+  fooAsdfLayoutRouteChildren,
+)
+
+interface fooAsdfanotherGroupLayoutRouteChildren {
+  fooAsdfanotherGroupLayoutBazRoute: typeof fooAsdfanotherGroupLayoutBazRoute
+}
+
+const fooAsdfanotherGroupLayoutRouteChildren: fooAsdfanotherGroupLayoutRouteChildren =
+  {
+    fooAsdfanotherGroupLayoutBazRoute: fooAsdfanotherGroupLayoutBazRoute,
+  }
+
+const fooAsdfanotherGroupLayoutRouteWithChildren =
+  fooAsdfanotherGroupLayoutRoute._addFileChildren(
+    fooAsdfanotherGroupLayoutRouteChildren,
+  )
+
+interface fooAsdfanotherGroupRouteChildren {
+  fooAsdfanotherGroupLayoutRoute: typeof fooAsdfanotherGroupLayoutRouteWithChildren
+}
+
+const fooAsdfanotherGroupRouteChildren: fooAsdfanotherGroupRouteChildren = {
+  fooAsdfanotherGroupLayoutRoute: fooAsdfanotherGroupLayoutRouteWithChildren,
+}
+
+const fooAsdfanotherGroupRouteWithChildren =
+  fooAsdfanotherGroupRoute._addFileChildren(fooAsdfanotherGroupRouteChildren)
+
+interface fooAsdfRouteChildren {
+  fooAsdfLayoutRoute: typeof fooAsdfLayoutRouteWithChildren
+  fooAsdfanotherGroupRoute: typeof fooAsdfanotherGroupRouteWithChildren
+  fooAsdfbarIdRoute: typeof fooAsdfbarIdRoute
+  fooAsdfbarLayoutAboutRoute: typeof fooAsdfbarLayoutAboutRoute
+  fooAsdfbarLayoutXyzLazyRoute: typeof fooAsdfbarLayoutXyzLazyRoute
+}
+
+const fooAsdfRouteChildren: fooAsdfRouteChildren = {
+  fooAsdfLayoutRoute: fooAsdfLayoutRouteWithChildren,
+  fooAsdfanotherGroupRoute: fooAsdfanotherGroupRouteWithChildren,
+  fooAsdfbarIdRoute: fooAsdfbarIdRoute,
+  fooAsdfbarLayoutAboutRoute: fooAsdfbarLayoutAboutRoute,
+  fooAsdfbarLayoutXyzLazyRoute: fooAsdfbarLayoutXyzLazyRoute,
+}
+
+const fooAsdfRouteWithChildren =
+  fooAsdfRoute._addFileChildren(fooAsdfRouteChildren)
+
 export interface FileRoutesByFullPath {
+  '/asdf': typeof fooAsdfLayoutRouteWithChildren
+  '/asdf/': typeof fooAsdfanotherGroupLayoutRouteWithChildren
   '/asdf/$id': typeof fooAsdfbarIdRoute
+  '/asdf/foo': typeof fooAsdfLayoutFooRoute
+  '/asdf/baz': typeof fooAsdfanotherGroupLayoutBazRoute
+  '/asdf/about': typeof fooAsdfbarLayoutAboutRoute
+  '/asdf/xyz': typeof fooAsdfbarLayoutXyzLazyRoute
 }
 
 export interface FileRoutesByTo {
+  '/asdf': typeof fooAsdfanotherGroupLayoutRouteWithChildren
   '/asdf/$id': typeof fooAsdfbarIdRoute
+  '/asdf/foo': typeof fooAsdfLayoutFooRoute
+  '/asdf/baz': typeof fooAsdfanotherGroupLayoutBazRoute
+  '/asdf/about': typeof fooAsdfbarLayoutAboutRoute
+  '/asdf/xyz': typeof fooAsdfbarLayoutXyzLazyRoute
 }
 
 export interface FileRoutesById {
   __root__: typeof rootRoute
-  '/asdf/$id': typeof fooAsdfbarIdRoute
+  '/(foo)/asdf': typeof fooAsdfRouteWithChildren
+  '/(foo)/asdf/_layout': typeof fooAsdfLayoutRouteWithChildren
+  '/(foo)/asdf/(another-group)': typeof fooAsdfanotherGroupRouteWithChildren
+  '/(foo)/asdf/(another-group)/_layout': typeof fooAsdfanotherGroupLayoutRouteWithChildren
+  '/(foo)/asdf/(bar)/$id': typeof fooAsdfbarIdRoute
+  '/(foo)/asdf/_layout/foo': typeof fooAsdfLayoutFooRoute
+  '/(foo)/asdf/(another-group)/_layout/baz': typeof fooAsdfanotherGroupLayoutBazRoute
+  '/(foo)/asdf/(bar)/_layout/about': typeof fooAsdfbarLayoutAboutRoute
+  '/(foo)/asdf/(bar)/_layout/xyz': typeof fooAsdfbarLayoutXyzLazyRoute
 }
 
 export interface FileRouteTypes {
   fileRoutesByFullPath: FileRoutesByFullPath
-  fullPaths: '/asdf/$id'
+  fullPaths:
+    | '/asdf'
+    | '/asdf/'
+    | '/asdf/$id'
+    | '/asdf/foo'
+    | '/asdf/baz'
+    | '/asdf/about'
+    | '/asdf/xyz'
   fileRoutesByTo: FileRoutesByTo
-  to: '/asdf/$id'
-  id: '__root__' | '/asdf/$id'
+  to:
+    | '/asdf'
+    | '/asdf/$id'
+    | '/asdf/foo'
+    | '/asdf/baz'
+    | '/asdf/about'
+    | '/asdf/xyz'
+  id:
+    | '__root__'
+    | '/(foo)/asdf'
+    | '/(foo)/asdf/_layout'
+    | '/(foo)/asdf/(another-group)'
+    | '/(foo)/asdf/(another-group)/_layout'
+    | '/(foo)/asdf/(bar)/$id'
+    | '/(foo)/asdf/_layout/foo'
+    | '/(foo)/asdf/(another-group)/_layout/baz'
+    | '/(foo)/asdf/(bar)/_layout/about'
+    | '/(foo)/asdf/(bar)/_layout/xyz'
   fileRoutesById: FileRoutesById
 }
 
 export interface RootRouteChildren {
-  fooAsdfbarIdRoute: typeof fooAsdfbarIdRoute
+  fooAsdfRoute: typeof fooAsdfRouteWithChildren
 }
 
 const rootRouteChildren: RootRouteChildren = {
-  fooAsdfbarIdRoute: fooAsdfbarIdRoute,
+  fooAsdfRoute: fooAsdfRouteWithChildren,
 }
 
 export const routeTree = rootRoute
@@ -78,11 +294,59 @@ export const routeTree = rootRoute
     "__root__": {
       "filePath": "__root.tsx",
       "children": [
-        "/asdf/$id"
+        "/(foo)/asdf"
       ]
     },
-    "/asdf/$id": {
-      "filePath": "(foo)/asdf/(bar)/$id.tsx"
+    "/(foo)/asdf": {
+      "filePath": "(foo)/asdf",
+      "children": [
+        "/(foo)/asdf/_layout",
+        "/(foo)/asdf/(another-group)",
+        "/(foo)/asdf/(bar)/$id",
+        "/(foo)/asdf/(bar)/_layout/about",
+        "/(foo)/asdf/(bar)/_layout/xyz"
+      ]
+    },
+    "/(foo)/asdf/_layout": {
+      "filePath": "(foo)/asdf/_layout.tsx",
+      "parent": "/(foo)/asdf",
+      "children": [
+        "/(foo)/asdf/_layout/foo"
+      ]
+    },
+    "/(foo)/asdf/(another-group)": {
+      "filePath": "(foo)/asdf/(another-group)",
+      "parent": "/(foo)/asdf",
+      "children": [
+        "/(foo)/asdf/(another-group)/_layout"
+      ]
+    },
+    "/(foo)/asdf/(another-group)/_layout": {
+      "filePath": "(foo)/asdf/(another-group)/_layout.tsx",
+      "parent": "/(foo)/asdf/(another-group)",
+      "children": [
+        "/(foo)/asdf/(another-group)/_layout/baz"
+      ]
+    },
+    "/(foo)/asdf/(bar)/$id": {
+      "filePath": "(foo)/asdf/(bar)/$id.tsx",
+      "parent": "/(foo)/asdf"
+    },
+    "/(foo)/asdf/_layout/foo": {
+      "filePath": "(foo)/asdf/_layout.foo.tsx",
+      "parent": "/(foo)/asdf/_layout"
+    },
+    "/(foo)/asdf/(another-group)/_layout/baz": {
+      "filePath": "(foo)/asdf/(another-group)/_layout.baz.tsx",
+      "parent": "/(foo)/asdf/(another-group)/_layout"
+    },
+    "/(foo)/asdf/(bar)/_layout/about": {
+      "filePath": "(foo)/asdf/(bar)/_layout.about.tsx",
+      "parent": "/(foo)/asdf"
+    },
+    "/(foo)/asdf/(bar)/_layout/xyz": {
+      "filePath": "(foo)/asdf/(bar)/_layout.xyz.lazy.tsx",
+      "parent": "/(foo)/asdf"
     }
   }
 }
diff --git a/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(another-group)/_layout.baz.tsx b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(another-group)/_layout.baz.tsx
new file mode 100644
index 000000000..ce8ed9a54
--- /dev/null
+++ b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(another-group)/_layout.baz.tsx
@@ -0,0 +1,7 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(foo)/asdf/(another-group)/_layout/baz')(
+  {
+    component: () => <div>Hello /(foo)/asdf/(another-group)/_layout/baz!</div>,
+  },
+)
diff --git a/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(another-group)/_layout.tsx b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(another-group)/_layout.tsx
new file mode 100644
index 000000000..c2e5c502f
--- /dev/null
+++ b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(another-group)/_layout.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(foo)/asdf/(another-group)/_layout')({
+  component: () => <div>Hello /(foo)/asdf/(another-group)/_layout!</div>,
+})
diff --git a/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/_layout.about.tsx b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/_layout.about.tsx
new file mode 100644
index 000000000..06daaef4e
--- /dev/null
+++ b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/_layout.about.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(foo)/asdf/(bar)/_layout/about')({
+  component: () => <div>Hello /(foo)/asdf/(bar)/_layout/about!</div>,
+})
diff --git a/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/_layout.xyz.lazy.tsx b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/_layout.xyz.lazy.tsx
new file mode 100644
index 000000000..955cd7f9b
--- /dev/null
+++ b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/_layout.xyz.lazy.tsx
@@ -0,0 +1,5 @@
+import { createLazyFileRoute } from '@tanstack/react-router'
+
+export const Route = createLazyFileRoute('/(foo)/asdf/(bar)/_layout/xyz')({
+  component: () => <div>Hello /(foo)/asdf/(bar)/_layout/xyz!</div>,
+})
diff --git a/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/_layout.foo.tsx b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/_layout.foo.tsx
new file mode 100644
index 000000000..a09050527
--- /dev/null
+++ b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/_layout.foo.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(foo)/asdf/_layout/foo')({
+  component: () => <div>Hello /(foo)/asdf/_layout/foo!</div>,
+})
diff --git a/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/_layout.tsx b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/_layout.tsx
new file mode 100644
index 000000000..681728467
--- /dev/null
+++ b/packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/_layout.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/(foo)/asdf/_layout')({
+  component: () => <div>Hello /(foo)/asdf/_layout!</div>,
+})