Skip to content

Commit

Permalink
fix: add location state
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Nov 16, 2022
1 parent 5a2ff56 commit 32b1e9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/router-core/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DefaultAllRouteInfo,
RouteInfoByPath,
} from './routeInfo'
import { Location } from './router'
import { Location, LocationState } from './router'
import { Expand, NoInfer, PickAsRequired, PickRequired, Updater } from './utils'

export type LinkInfo =
Expand Down Expand Up @@ -126,6 +126,8 @@ export type ToOptions<
to?: ToPathOption<TAllRouteInfo, TFrom, TTo>
// The new has string or a function to update it
hash?: Updater<string>
// State to pass to the history stack
state?: LocationState
// The source route path. This is automatically set when using route-level APIs, but for type-safe relative routing on the router itself, this is required
from?: TFrom
// // When using relative route paths, this option forces resolution from the current path, instead of the route API's path or `from` path
Expand Down
2 changes: 2 additions & 0 deletions packages/router-core/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export interface BuildNextOptions {
params?: true | Updater<Record<string, any>>
search?: true | Updater<unknown>
hash?: true | Updater<string>
state?: LocationState
key?: string
from?: string
fromCurrent?: boolean
Expand Down Expand Up @@ -1258,6 +1259,7 @@ export function createRouter<
},
{
id,
...next.state,
},
)
} else {
Expand Down

0 comments on commit 32b1e9b

Please sign in to comment.