fixes home route matching everything
This commit is contained in:
parent
accc278d96
commit
1a8c2907ca
|
@ -44,7 +44,7 @@ export const screenRouter = ({ screens, onScreenSelected, window }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const routes = screens.map(s => makeRootedPath(s.route))
|
const routes = screens.map(s => makeRootedPath(s.route))
|
||||||
let fallback = routes.findIndex(([p]) => p === "*")
|
let fallback = routes.findIndex(([p]) => p === makeRootedPath("*"))
|
||||||
if (fallback < 0) fallback = 0
|
if (fallback < 0) fallback = 0
|
||||||
|
|
||||||
let current
|
let current
|
||||||
|
@ -53,7 +53,7 @@ export const screenRouter = ({ screens, onScreenSelected, window }) => {
|
||||||
const _url = makeRootedPath(url.state || url)
|
const _url = makeRootedPath(url.state || url)
|
||||||
current = routes.findIndex(
|
current = routes.findIndex(
|
||||||
p =>
|
p =>
|
||||||
p !== "*" &&
|
p !== makeRootedPath("*") &&
|
||||||
new RegExp("^" + p.toLowerCase() + "$").test(_url.toLowerCase())
|
new RegExp("^" + p.toLowerCase() + "$").test(_url.toLowerCase())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@ export const screenRouter = ({ screens, onScreenSelected, window }) => {
|
||||||
|
|
||||||
if (current === -1) {
|
if (current === -1) {
|
||||||
routes.forEach((p, i) => {
|
routes.forEach((p, i) => {
|
||||||
|
// ignore home - which matched everything
|
||||||
|
if (p === makeRootedPath("*")) return
|
||||||
const pm = regexparam(p)
|
const pm = regexparam(p)
|
||||||
const matches = pm.pattern.exec(_url)
|
const matches = pm.pattern.exec(_url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue