@pinnacle0/react-stack-router
Advanced tools
Comparing version 0.1.3-beta.40 to 0.1.3-beta.41
@@ -27,3 +27,3 @@ import { Action } from "history"; | ||
const { pathname, hash, search } = window.location; | ||
const matched = this.matchRoute(pathname, true); | ||
const matched = this.matchRoute(pathname); | ||
let numOfParentComponent = 0; | ||
@@ -108,7 +108,5 @@ let parentPattern = matched.payload.pattern.parent; | ||
} | ||
matchRoute(to, allowFallbackMatch = false) { | ||
matchRoute(to) { | ||
const pathname = typeof to === "string" ? to : to.pathname; | ||
const matched = this.route.lookup(pathname ?? window.location.pathname); | ||
if (!allowFallbackMatch) | ||
return matched?.fallback ? null : matched; | ||
invariant(matched, `None of the route match current pathname:${pathname}. Please make sure you have defined fallback route using "**"`); | ||
@@ -115,0 +113,0 @@ return matched; |
{ | ||
"name": "@pinnacle0/react-stack-router", | ||
"version": "0.1.3-beta.40", | ||
"version": "0.1.3-beta.41", | ||
"author": "Pinnacle", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -59,3 +59,3 @@ import {Action} from "history"; | ||
const {pathname, hash, search} = window.location; | ||
const matched = this.matchRoute(pathname, true); | ||
const matched = this.matchRoute(pathname); | ||
@@ -158,9 +158,5 @@ let numOfParentComponent = 0; | ||
private matchRoute(to: To): Match<StackRoutePayload> | null; | ||
private matchRoute(to: To, allowFallbackMatch: true): Match<StackRoutePayload>; | ||
private matchRoute(to: To, allowFallbackMatch: boolean = false): Match<StackRoutePayload> | null { | ||
private matchRoute(to: To): Match<StackRoutePayload> { | ||
const pathname = typeof to === "string" ? to : to.pathname; | ||
const matched = this.route.lookup(pathname ?? window.location.pathname); | ||
if (!allowFallbackMatch) return matched?.fallback ? null : matched; | ||
invariant(matched, `None of the route match current pathname:${pathname}. Please make sure you have defined fallback route using "**"`); | ||
@@ -167,0 +163,0 @@ return matched; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
159568
2491