@tanstack/react-router
Advanced tools
Comparing version 1.64.1 to 1.64.2
@@ -8,3 +8,3 @@ "use client"; | ||
import { useForwardedRef, deepEqual, useIntersectionObserver, functionalUpdate } from "./utils.js"; | ||
import { removeTrailingSlash, exactPathTest } from "./path.js"; | ||
import { exactPathTest, removeTrailingSlash } from "./path.js"; | ||
const preloadWarning = "Error preloading route! ☝️"; | ||
@@ -65,17 +65,41 @@ function useLinkProps(options, forwardedRef) { | ||
select: (s) => { | ||
const currentPathSplit = removeTrailingSlash( | ||
s.location.pathname, | ||
router.basepath | ||
).split("/"); | ||
const nextPathSplit = removeTrailingSlash( | ||
next.pathname, | ||
router.basepath | ||
).split("/"); | ||
const pathIsFuzzyEqual = nextPathSplit.every( | ||
(d, i) => d === currentPathSplit[i] | ||
); | ||
const pathTest = (activeOptions == null ? void 0 : activeOptions.exact) ? exactPathTest(s.location.pathname, next.pathname, router.basepath) : pathIsFuzzyEqual; | ||
const hashTest = (activeOptions == null ? void 0 : activeOptions.includeHash) ? s.location.hash === next.hash : true; | ||
const searchTest = (activeOptions == null ? void 0 : activeOptions.includeSearch) ?? true ? deepEqual(s.location.search, next.search, !(activeOptions == null ? void 0 : activeOptions.exact)) : true; | ||
return pathTest && hashTest && searchTest; | ||
if (activeOptions == null ? void 0 : activeOptions.exact) { | ||
const testExact = exactPathTest( | ||
s.location.pathname, | ||
next.pathname, | ||
router.basepath | ||
); | ||
if (!testExact) { | ||
return false; | ||
} | ||
} else { | ||
const currentPathSplit = removeTrailingSlash( | ||
s.location.pathname, | ||
router.basepath | ||
).split("/"); | ||
const nextPathSplit = removeTrailingSlash( | ||
next.pathname, | ||
router.basepath | ||
).split("/"); | ||
const pathIsFuzzyEqual = nextPathSplit.every( | ||
(d, i) => d === currentPathSplit[i] | ||
); | ||
if (!pathIsFuzzyEqual) { | ||
return false; | ||
} | ||
} | ||
if ((activeOptions == null ? void 0 : activeOptions.includeSearch) ?? true) { | ||
const searchTest = deepEqual( | ||
s.location.search, | ||
next.search, | ||
!(activeOptions == null ? void 0 : activeOptions.exact) | ||
); | ||
if (!searchTest) { | ||
return false; | ||
} | ||
} | ||
if (activeOptions == null ? void 0 : activeOptions.includeHash) { | ||
return s.location.hash === next.hash; | ||
} | ||
return true; | ||
} | ||
@@ -82,0 +106,0 @@ }); |
{ | ||
"name": "@tanstack/react-router", | ||
"version": "1.64.1", | ||
"version": "1.64.2", | ||
"description": "Modern and scalable routing for React applications", | ||
@@ -5,0 +5,0 @@ "author": "Tanner Linsley", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1531371
19239