@tanstack/react-router 0.0.1-beta.254 → 0.0.1-beta.256

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.254",
4
+ "version": "0.0.1-beta.256",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -44,7 +44,7 @@
44
44
  "@tanstack/store": "^0.1.3",
45
45
  "tiny-invariant": "^1.3.1",
46
46
  "tiny-warning": "^1.0.3",
47
- "@tanstack/history": "0.0.1-beta.254"
47
+ "@tanstack/history": "0.0.1-beta.256"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
package/src/router.ts CHANGED
@@ -710,11 +710,14 @@ export class Router<
710
710
  matches?: AnyRouteMatch[],
711
711
  ): ParsedLocation => {
712
712
  const from = this.latestLocation
713
+ const fromSearch =
714
+ (this.state.pendingMatches || this.state.matches).at(-1)?.search ||
715
+ from.search
713
716
  const fromPathname = dest.from ?? from.pathname
714
717
 
715
718
  let pathname = this.resolvePathWithBase(fromPathname, `${dest.to ?? ''}`)
716
719
 
717
- const fromMatches = this.matchRoutes(fromPathname, from.search)
720
+ const fromMatches = this.matchRoutes(fromPathname, fromSearch)
718
721
  const stayingMatches = matches?.filter(
719
722
  (d) => fromMatches?.find((e) => e.routeId === d.routeId),
720
723
  )
@@ -761,9 +764,9 @@ export class Router<
761
764
  const preFilteredSearch = preSearchFilters?.length
762
765
  ? preSearchFilters?.reduce(
763
766
  (prev, next) => next(prev) as any,
764
- from.search,
767
+ fromSearch,
765
768
  )
766
- : from.search
769
+ : fromSearch
767
770
 
768
771
  // Then the link/navigate function
769
772
  const destSearch =
@@ -780,7 +783,7 @@ export class Router<
780
783
  ? postSearchFilters.reduce((prev, next) => next(prev), destSearch)
781
784
  : destSearch
782
785
 
783
- const search = replaceEqualDeep(from.search, postFilteredSearch)
786
+ const search = replaceEqualDeep(fromSearch, postFilteredSearch)
784
787
 
785
788
  const searchStr = this.options.stringifySearch(search)
786
789
 
@@ -59,7 +59,7 @@ export function Navigate<
59
59
  const { navigate } = useRouter()
60
60
  const match = useMatch({ strict: false })
61
61
 
62
- useLayoutEffect(() => {
62
+ React.useEffect(() => {
63
63
  navigate({
64
64
  from: props.to ? match.pathname : undefined,
65
65
  ...props,