Repository: TanStack/router (ts)

Issue:
Wrong route id for preloaded routes after rebuild route tree
### Which project does this relate to?

Router

### Describe the bug

After a route (it needs to have a lazy route) `/_protected/test` got preloaded, then we call `router.buildRouteTree()` to rebuild the route tree again, that route will have a wrong id `/_protected/_protected/test`.

### Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-s8qswn?file=src%2FApp.tsx

### Steps to Reproduce the Bug or Issue

1. Open my StackBlitz example.
2. It should automatically run the project. If not, just `npm run start`
3. Open browser devtool's console.
4. Click the first button to print `router.routesById`, in the console you can confirm all routes' ids are fine.
5. Click the second button, it preloads the `/_protected/test` route.
6. Click the third button to run `router.buildRouteTree()`
7. Click the fourth button to print `router.routesById` again, in the console you can see the preloaded route `/test` now has a wrong id: `/_protected/_protected/test`

### Expected behavior

No matter how many times I rebuild the route tree, the result should be consistent. 
I'm doing dynamic route injection, so I need to rebuild the route tree after there is a new route got injected.

### Screenshots or Videos

https://github.com/user-attachments/assets/d7db270f-4d76-4f0d-a1bc-5bc433e8c53b


### Platform

- OS: [Windows]
- Browser: [Chrome]
- Version: [1.58.3]


### Additional context

**How the issue happened**
1. This is currently how we generate id for a route instance in its `init()` method:
```typescript
    const customId = options?.id || path // Uses path as id's fallback

    // Strip the parentId prefix from the first level of children
    let id = isRoot
      ? rootRouteId
      : joinPaths([
          this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,
          customId,
        ])
``` 
Related code: https://github.com/TanStack/router/blob/main/packages/react-router/src/route.ts#L1032

2. During the first initialization of the router, everything is fine because it fall back to the path, and the path doesn't contain a prefix from parent.

3. When we preload the route, the lazy route's options will be assign to the primary route object, so that the primary route object now has an `id` in its `options` property. Related code: https://github.com/TanStack/router/blob/main/packages/react-router/src/router.ts#L2247

4. Now we call `router.buildRouteTree()` to manually rebuild it, now the `customId` will be `/_protected/test`, and we are joining it with parent's id again, so we get `/_protected/_protected/test`.

I believe we should trim the parant prefix when using `options.id` as `customId`

Pull request description:
fix(react-router): do not copy `id` from lazy route over to non-lazy route
fixes #2400

Patch:
diff --git a/examples/react/authenticated-routes/package.json b/examples/react/authenticated-routes/package.json
index e59433f55..63d846968 100644
--- a/examples/react/authenticated-routes/package.json
+++ b/examples/react/authenticated-routes/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic-default-search-params/package.json b/examples/react/basic-default-search-params/package.json
index 526155b69..73660224b 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.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 b652d3e1a..a7cd8e079 100644
--- a/examples/react/basic-file-based-codesplitting/package.json
+++ b/examples/react/basic-file-based-codesplitting/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic-file-based/package.json b/examples/react/basic-file-based/package.json
index 1cfdd1e1a..0adacc770 100644
--- a/examples/react/basic-file-based/package.json
+++ b/examples/react/basic-file-based/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic-react-query-file-based/package.json b/examples/react/basic-react-query-file-based/package.json
index 39df17da8..00acc6b7b 100644
--- a/examples/react/basic-react-query-file-based/package.json
+++ b/examples/react/basic-react-query-file-based/package.json
@@ -11,8 +11,8 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.0",
     "@tanstack/react-query-devtools": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/basic-react-query/package.json b/examples/react/basic-react-query/package.json
index 7188d5089..3f38a257a 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.0",
     "@tanstack/react-query-devtools": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 be597842b..c6b7702af 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/start": "^1.63.3",
     "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 10f941d97..7e71e1f17 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/start": "^1.63.3",
     "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 5ce07780b..9102c3a3f 100644
--- a/examples/react/basic-virtual-file-based/package.json
+++ b/examples/react/basic-virtual-file-based/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "@tanstack/virtual-file-routes": "^1.56.0",
     "react": "^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 45e9e0c9b..ec3aa19e5 100644
--- a/examples/react/basic-virtual-inside-file-based/package.json
+++ b/examples/react/basic-virtual-inside-file-based/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "@tanstack/virtual-file-routes": "^1.56.0",
     "react": "^18.2.0",
diff --git a/examples/react/basic/package.json b/examples/react/basic/package.json
index a1d144147..51220b2db 100644
--- a/examples/react/basic/package.json
+++ b/examples/react/basic/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 921f95805..36ad5d5e7 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 c9942fd87..dc1f9448c 100644
--- a/examples/react/kitchen-sink-file-based/package.json
+++ b/examples/react/kitchen-sink-file-based/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "immer": "^10.1.1",
     "react": "^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 7124f3f99..e633cba1e 100644
--- a/examples/react/kitchen-sink-react-query-file-based/package.json
+++ b/examples/react/kitchen-sink-react-query-file-based/package.json
@@ -11,8 +11,8 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.0",
     "@tanstack/react-query-devtools": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "immer": "^10.1.1",
     "react": "^18.2.0",
diff --git a/examples/react/kitchen-sink-react-query/package.json b/examples/react/kitchen-sink-react-query/package.json
index 555452299..c36c809bf 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.0",
     "@tanstack/react-query-devtools": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 ec94b074c..d915dad75 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 19c8fb6b7..7c2b9376d 100644
--- a/examples/react/large-file-based/package.json
+++ b/examples/react/large-file-based/package.json
@@ -12,8 +12,8 @@
   },
   "dependencies": {
     "@tanstack/react-query": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/location-masking/package.json b/examples/react/location-masking/package.json
index f75a55f82..67c491254 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.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 1f82f8af2..31e53bd0a 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.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 e16a09100..86023e6ec 100644
--- a/examples/react/quickstart-file-based/package.json
+++ b/examples/react/quickstart-file-based/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
diff --git a/examples/react/quickstart-rspack-file-based/package.json b/examples/react/quickstart-rspack-file-based/package.json
index 048ffd241..e41146e7f 100644
--- a/examples/react/quickstart-rspack-file-based/package.json
+++ b/examples/react/quickstart-rspack-file-based/package.json
@@ -8,8 +8,8 @@
     "preview": "rsbuild preview"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "react": "^18.3.1",
     "react-dom": "^18.3.1"
   },
diff --git a/examples/react/quickstart-webpack-file-based/package.json b/examples/react/quickstart-webpack-file-based/package.json
index 177338835..f462168dd 100644
--- a/examples/react/quickstart-webpack-file-based/package.json
+++ b/examples/react/quickstart-webpack-file-based/package.json
@@ -7,8 +7,8 @@
     "build": "webpack build && tsc --noEmit"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "react": "^18.3.1",
     "react-dom": "^18.3.1"
   },
diff --git a/examples/react/quickstart/package.json b/examples/react/quickstart/package.json
index 4ac311f0a..01d1ea647 100644
--- a/examples/react/quickstart/package.json
+++ b/examples/react/quickstart/package.json
@@ -9,8 +9,8 @@
     "start": "vite"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 2d7f9d6bf..eeee6e910 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.63.1",
+    "@tanstack/react-router": "^1.63.2",
     "@tanstack/react-virtual": "^3.10.8",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/router-devtools": "^1.63.2",
     "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 7d99a3b97..62eaf11b7 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.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-arktype-adapter": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-arktype-adapter": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
-    "@tanstack/router-valibot-adapter": "^1.63.1",
-    "@tanstack/router-zod-adapter": "^1.63.1",
+    "@tanstack/router-valibot-adapter": "^1.63.2",
+    "@tanstack/router-zod-adapter": "^1.63.2",
     "arktype": "^2.0.0-rc.14",
     "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 d1750a26f..c505e6707 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "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 6d6cca14a..d56de9a57 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.0",
     "@tanstack/react-query-devtools": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/react-router-with-query": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/react-router-with-query": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "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 dfd8b4f57..fb66da15b 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "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 7d9bc6c11..efc41d31c 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "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 a94184b9d..7d8b4195c 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.11",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "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 2395bcc3a..46456b2ce 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.0",
     "@tanstack/react-query-devtools": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/react-router-with-query": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/react-router-with-query": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "@convex-dev/react-query": "0.0.0-alpha.5",
     "concurrently": "^8.2.2",
     "convex": "^1.16.3",
diff --git a/examples/react/start-counter/package.json b/examples/react/start-counter/package.json
index 10b4eb888..d1b2311f0 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.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "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 928728a40..fd29af640 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "@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 099c01399..e79d2ed71 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.0",
     "@tanstack/react-query-devtools": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/react-router-with-query": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
-    "@tanstack/start": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/react-router-with-query": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
+    "@tanstack/start": "^1.63.3",
     "ky": "^1.7.2",
     "msw": "^2.4.9",
     "react": "^18.3.1",
diff --git a/examples/react/with-framer-motion/package.json b/examples/react/with-framer-motion/package.json
index 9da85c428..0dd8fb187 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.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "redaxios": "^0.5.1",
     "framer-motion": "^11.11.1",
     "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 490cf940f..89e45f995 100644
--- a/examples/react/with-trpc-react-query/package.json
+++ b/examples/react/with-trpc-react-query/package.json
@@ -10,8 +10,8 @@
   "dependencies": {
     "@tanstack/react-query": "^5.59.0",
     "@tanstack/react-query-devtools": "^5.59.0",
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "@trpc/client": "11.0.0-rc.561",
     "@trpc/react-query": "11.0.0-rc.561",
diff --git a/examples/react/with-trpc/package.json b/examples/react/with-trpc/package.json
index fa1a0777c..ab9a40e42 100644
--- a/examples/react/with-trpc/package.json
+++ b/examples/react/with-trpc/package.json
@@ -8,8 +8,8 @@
     "start": "vinxi start"
   },
   "dependencies": {
-    "@tanstack/react-router": "^1.63.1",
-    "@tanstack/router-devtools": "^1.63.1",
+    "@tanstack/react-router": "^1.63.2",
+    "@tanstack/router-devtools": "^1.63.2",
     "@tanstack/router-plugin": "^1.62.0",
     "@trpc/client": "11.0.0-rc.561",
     "@trpc/server": "11.0.0-rc.561",
diff --git a/packages/create-router/package.json b/packages/create-router/package.json
index 025d169c3..f9581d452 100644
--- a/packages/create-router/package.json
+++ b/packages/create-router/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/create-router",
-  "version": "1.63.1",
+  "version": "1.63.2",
   "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 39140bb3f..07f380bba 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.63.1",
+  "version": "1.63.2",
   "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 f6f3aa2a4..68f474cbd 100644
--- a/packages/react-router/package.json
+++ b/packages/react-router/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/react-router",
-  "version": "1.63.1",
+  "version": "1.63.2",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/react-router/src/path.ts b/packages/react-router/src/path.ts
index c77ea0987..7569ba31b 100644
--- a/packages/react-router/src/path.ts
+++ b/packages/react-router/src/path.ts
@@ -298,6 +298,10 @@ export function matchByPath(
   from: string,
   matchLocation: Pick<MatchLocation, 'to' | 'caseSensitive' | 'fuzzy'>,
 ): Record<string, string> | undefined {
+  // check basepath first
+  if (basepath !== '/' && !from.startsWith(basepath)) {
+    return undefined
+  }
   // Remove the base path from the pathname
   from = removeBasepath(basepath, from)
   // Default to to $ (wildcard)
diff --git a/packages/react-router/src/router.ts b/packages/react-router/src/router.ts
index 8d7834852..2c66b7168 100644
--- a/packages/react-router/src/router.ts
+++ b/packages/react-router/src/router.ts
@@ -2254,10 +2254,8 @@ export class Router<
                             route._lazyPromise ||
                             (route.lazyFn
                               ? route.lazyFn().then((lazyRoute) => {
-                                  Object.assign(
-                                    route.options,
-                                    lazyRoute.options,
-                                  )
+                                  const { id, ...options } = lazyRoute.options
+                                  Object.assign(route.options, options)
                                 })
                               : Promise.resolve())
 
diff --git a/packages/router-arktype-adapter/package.json b/packages/router-arktype-adapter/package.json
index 1a2e68276..a12df0275 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.63.1",
+  "version": "1.63.2",
   "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 bc08f71a9..38bd29191 100644
--- a/packages/router-devtools/package.json
+++ b/packages/router-devtools/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/router-devtools",
-  "version": "1.63.1",
+  "version": "1.63.2",
   "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 3ca5225ed..bdec74bbb 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.63.1",
+  "version": "1.63.2",
   "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 66049343d..5b8f85354 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.63.1",
+  "version": "1.63.2",
   "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 7a3ac31bd..8b5fa33d8 100644
--- a/packages/start/package.json
+++ b/packages/start/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start",
-  "version": "1.63.1",
+  "version": "1.63.3",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/start/src/config/index.ts b/packages/start/src/config/index.ts
index 26ed08000..0b3738730 100644
--- a/packages/start/src/config/index.ts
+++ b/packages/start/src/config/index.ts
@@ -257,6 +257,7 @@ export function defineConfig(
       ...serverOptions,
       preset: deploymentPreset,
       experimental: {
+        ...serverOptions.experimental,
         asyncContext: true,
       },
     },


Test patch:
diff --git a/packages/react-router/tests/path.test.ts b/packages/react-router/tests/path.test.ts
index d77719c2a..0e9212524 100644
--- a/packages/react-router/tests/path.test.ts
+++ b/packages/react-router/tests/path.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest'
 import {
   exactPathTest,
   interpolatePath,
+  matchPathname,
   removeBasepath,
   removeTrailingSlash,
   resolvePath,
@@ -276,3 +277,57 @@ describe('interpolatePath', () => {
     })
   })
 })
+
+describe('matchPathname', () => {
+  it.each([
+    {
+      name: 'should match the root path that start with the basepath',
+      basepath: '/basepath',
+      pathname: '/basepath',
+      matchLocation: {
+        to: '/',
+      },
+      expected: {},
+    },
+    {
+      name: 'should match the path that start with the basepath',
+      basepath: '/basepath',
+      pathname: '/basepath/abc',
+      matchLocation: {
+        to: '/abc',
+      },
+      expected: {},
+    },
+    {
+      name: 'should not match the root path that does not start with the basepath',
+      basepath: '/basepath',
+      pathname: '/',
+      matchLocation: {
+        to: '/',
+      },
+      expected: undefined,
+    },
+    {
+      name: 'should not match the path that does not start with the basepath',
+      basepath: '/basepath',
+      pathname: '/abc',
+      matchLocation: {
+        to: '/abc',
+      },
+      expected: undefined,
+    },
+    {
+      name: 'should not match the path that match partial of the basepath',
+      basepath: '/base',
+      pathname: '/basepath/abc',
+      matchLocation: {
+        to: '/abc',
+      },
+      expected: undefined,
+    },
+  ])('$name', ({ basepath, pathname, matchLocation, expected }) => {
+    expect(matchPathname(basepath, pathname, matchLocation)).toStrictEqual(
+      expected,
+    )
+  })
+})