router-dom
Advanced tools
Comparing version 2.2.6 to 2.2.7
@@ -13,4 +13,6 @@ import { pathToRegexp, match } from "path-to-regexp"; | ||
addEventListener("popstate", async (e) => { | ||
//@ts-expect-error | ||
router.doRouting(location.pathname + location.search, e); | ||
if (!window.isHMR) { | ||
//@ts-expect-error | ||
router.doRouting(location.pathname + location.search, e); | ||
} | ||
}); | ||
@@ -302,4 +304,6 @@ // Reload -> store scrollPosition | ||
const copy = where.cloneNode(); | ||
copy.append(html `${(await cacheObj.html) || ""}`); | ||
copy.append(window.isHMR | ||
? html `${await (await fetch(route.templateUrl)).text()}` | ||
: html `${(await cacheObj.html) || ""}`); | ||
render(copy, where, false); | ||
} |
{ | ||
"name": "router-dom", | ||
"version": "2.2.6", | ||
"version": "2.2.7", | ||
"description": "A lightweight router for everyone", | ||
@@ -29,6 +29,6 @@ "type": "module", | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@web/test-runner": "^0.13.20", | ||
"@web/test-runner": "^0.13.23", | ||
"@web/test-runner-playwright": "^0.8.8", | ||
"esbuild": "^0.13.9", | ||
"typescript": "^4.4.4" | ||
"esbuild": "^0.14.8", | ||
"typescript": "^4.5.4" | ||
}, | ||
@@ -41,5 +41,5 @@ "repository": { | ||
"dependencies": { | ||
"hydro-js": "^1.4.6", | ||
"hydro-js": "^1.5.2", | ||
"path-to-regexp": "^6.2.0" | ||
} | ||
} |
@@ -15,5 +15,12 @@ import type { MatchResult } from "path-to-regexp"; | ||
interface CustomWindow extends Window { | ||
isHMR: boolean; | ||
} | ||
declare var window: CustomWindow; | ||
addEventListener("popstate", async (e) => { | ||
//@ts-expect-error | ||
router.doRouting(location.pathname + location.search, e); | ||
if (!window.isHMR) { | ||
//@ts-expect-error | ||
router.doRouting(location.pathname + location.search, e); | ||
} | ||
}); | ||
@@ -348,3 +355,7 @@ | ||
const copy = where.cloneNode(); | ||
(copy as Element).append(html`${(await cacheObj!.html) || ""}`); | ||
(copy as Element).append( | ||
window.isHMR | ||
? html`${await (await fetch(route.templateUrl!)).text()}` | ||
: html`${(await cacheObj!.html) || ""}` | ||
); | ||
render(copy, where, false); | ||
@@ -351,0 +362,0 @@ } |
60920
735
4
Updatedhydro-js@^1.5.2