router-dom
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -13,3 +13,3 @@ import { listen } from "quicklink"; | ||
try { | ||
const to = history.state?.path || location.pathname; | ||
const to = history.state?.path ?? location.pathname; | ||
const [_, ...values] = to.match(route.path); | ||
@@ -23,3 +23,3 @@ const params = Array.from(route.originalPath.matchAll(/(?<=:)\w+/g)) | ||
const props = { | ||
from: router.oldRoute || to, | ||
from: router.oldRoute ?? to, | ||
to, | ||
@@ -134,3 +134,3 @@ state, | ||
} | ||
else if (href.startsWith("/")) { | ||
else if (href.startsWith("/") && href.length > 1) { | ||
href = href.replace("/", ""); | ||
@@ -137,0 +137,0 @@ } |
{ | ||
"name": "router-dom", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A lightweight router for everyone", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -29,5 +29,6 @@ # router-dom | ||
```html | ||
<!-- If needed with base --> | ||
<!-- With base --> | ||
<base href="/.../" /> | ||
<a href="./about" data="about">About</a> | ||
<!-- href="about" without base --> | ||
<div data-outlet></div> | ||
@@ -34,0 +35,0 @@ ``` |
@@ -17,3 +17,3 @@ import { listen } from "quicklink"; | ||
try { | ||
const to = history.state?.path || location.pathname; | ||
const to = history.state?.path ?? location.pathname; | ||
@@ -29,3 +29,3 @@ const [_, ...values] = to.match(route.path); | ||
const props = { | ||
from: router.oldRoute || to, | ||
from: router.oldRoute ?? to, | ||
to, | ||
@@ -169,3 +169,3 @@ state, | ||
href = href.replace("./", ""); | ||
} else if (href.startsWith("/")) { | ||
} else if (href.startsWith("/") && href.length > 1) { | ||
href = href.replace("/", ""); | ||
@@ -172,0 +172,0 @@ } |
18934
92