clear-react-router 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -243,20 +243,20 @@ var l = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
243
243
|
constructor(e, t) {
|
|
244
244
|
this.url = e, this.search = t, this.cause = "redirect";
|
|
245
245
|
}
|
|
246
|
-
}, D = (e, t) =>
|
|
246
|
+
}, D = (e, t) => Promise.reject(new E(e, t)), O = ({ setLocation: e, routeList: t, context: n, revalidateCache: i }) => {
|
|
247
247
|
let [l, u] = c({
|
|
248
248
|
from: "",
|
|
249
249
|
to: ""
|
|
250
250
|
}), d = s(""), f = v(r(async (r) => {
|
|
251
251
|
try {
|
|
252
252
|
let a = t.find((e) => T(e, r.pathname));
|
|
253
|
-
a?.beforeLoad && await a?.beforeLoad(n), e(r), r.pathname !== window.location.pathname && (history.pushState(null, "", r.pathname), d.current = r.pathname), await i(a), a?.afterLoad && await a?.afterLoad(n);
|
|
253
|
+
console.log("before beforeLoad execution", a, n), a?.beforeLoad && await a?.beforeLoad(n), console.log("after beforeLoad execution", a, n), e(r), console.log(r.pathname !== window.location.pathname), r.pathname !== window.location.pathname && (history.pushState(null, "", r.pathname), d.current = r.pathname), await i(a), a?.afterLoad && await a?.afterLoad(n);
|
|
254
254
|
} catch (t) {
|
|
255
|
-
if (console.log("redirect
|
|
256
|
-
|
|
255
|
+
if (console.log("redirect", t), !(t instanceof E)) return t;
|
|
256
|
+
history.replaceState(null, "", `${t.url}${t.search || ""}`), e({
|
|
257
257
|
pathname: t.url,
|
|
258
258
|
search: t.search
|
|
259
|
-
})
|
|
259
|
+
});
|
|
260
260
|
}
|
|
261
261
|
}, [
|
|
262
262
|
n,
|