@tanstack/react-router
Advanced tools
Comparing version
@@ -40,5 +40,5 @@ import { UseParamsRoute } from './useParams.js'; | ||
useLoaderData: UseLoaderDataRoute<TRoute['id']>; | ||
useNavigate: () => import('@tanstack/router-core').UseNavigateResult<string>; | ||
useNavigate: () => import('@tanstack/router-core').UseNavigateResult<any>; | ||
} | ||
export declare function createLazyRoute<TRouter extends AnyRouter = RegisteredRouter, TId extends string = string, TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): (opts: LazyRouteOptions) => LazyRoute<TRoute>; | ||
export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>; |
@@ -9,2 +9,3 @@ import warning from "tiny-warning"; | ||
import { useNavigate } from "./useNavigate.js"; | ||
import { useRouter } from "./useRouter.js"; | ||
function createFileRoute(path) { | ||
@@ -73,3 +74,4 @@ return new FileRoute(path, { | ||
this.useNavigate = () => { | ||
return useNavigate({ from: this.options.id }); | ||
const router = useRouter(); | ||
return useNavigate({ from: router.routesById[this.options.id].fullPath }); | ||
}; | ||
@@ -76,0 +78,0 @@ this.options = opts; |
@@ -10,2 +10,3 @@ import invariant from "tiny-invariant"; | ||
import { useMatch } from "./useMatch.js"; | ||
import { useRouter } from "./useRouter.js"; | ||
function getRouteApi(id) { | ||
@@ -53,3 +54,4 @@ return new RouteApi({ id }); | ||
this.useNavigate = () => { | ||
return useNavigate({ from: this.id }); | ||
const router = useRouter(); | ||
return useNavigate({ from: router.routesById[this.id].fullPath }); | ||
}; | ||
@@ -165,3 +167,3 @@ this.notFound = (opts) => { | ||
this.useNavigate = () => { | ||
return useNavigate({ from: this.id }); | ||
return useNavigate({ from: this.fullPath }); | ||
}; | ||
@@ -168,0 +170,0 @@ this.options = options || {}; |
{ | ||
"name": "@tanstack/react-router", | ||
"version": "1.112.17", | ||
"version": "1.112.18", | ||
"description": "Modern and scalable routing for React applications", | ||
@@ -56,4 +56,4 @@ "author": "Tanner Linsley", | ||
"tiny-warning": "^1.0.3", | ||
"@tanstack/router-core": "^1.112.12", | ||
"@tanstack/history": "1.112.8" | ||
"@tanstack/history": "1.112.18", | ||
"@tanstack/router-core": "^1.112.18" | ||
}, | ||
@@ -60,0 +60,0 @@ "devDependencies": { |
@@ -10,2 +10,3 @@ import warning from 'tiny-warning' | ||
import { useNavigate } from './useNavigate' | ||
import { useRouter } from './useRouter' | ||
import type { UseParamsRoute } from './useParams' | ||
@@ -218,3 +219,4 @@ import type { UseMatchRoute } from './useMatch' | ||
useNavigate = () => { | ||
return useNavigate({ from: this.options.id }) | ||
const router = useRouter() | ||
return useNavigate({ from: router.routesById[this.options.id].fullPath }) | ||
} | ||
@@ -221,0 +223,0 @@ } |
@@ -10,2 +10,3 @@ import invariant from 'tiny-invariant' | ||
import { useMatch } from './useMatch' | ||
import { useRouter } from './useRouter' | ||
import type { | ||
@@ -137,3 +138,4 @@ AnyContext, | ||
> => { | ||
return useNavigate({ from: this.id as string }) | ||
const router = useRouter() | ||
return useNavigate({ from: router.routesById[this.id as string].fullPath }) | ||
} | ||
@@ -533,3 +535,3 @@ | ||
useNavigate = (): UseNavigateResult<TFullPath> => { | ||
return useNavigate({ from: this.id }) | ||
return useNavigate({ from: this.fullPath }) | ||
} | ||
@@ -536,0 +538,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1267564
0.1%16716
0.07%+ Added
+ Added
- Removed
- Removed
Updated