react-router-dom-v5-compat 6.14.1 → 6.14.2-pre.0
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/CHANGELOG.md +8 -0
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router-dom/dom.d.ts +4 -0
- package/dist/react-router-dom/index.d.ts +19 -13
- package/dist/umd/react-router-dom-v5-compat.development.js +29 -8
- package/dist/umd/react-router-dom-v5-compat.development.js.map +1 -1
- package/dist/umd/react-router-dom-v5-compat.production.min.js +2 -2
- package/dist/umd/react-router-dom-v5-compat.production.min.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router DOM v5 Compat v6.14.
|
|
2
|
+
* React Router DOM v5 Compat v6.14.2-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -205,7 +205,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
205
205
|
|
|
206
206
|
const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset"],
|
|
207
207
|
_excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"],
|
|
208
|
-
_excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "submit", "relative", "preventScrollReset"];
|
|
208
|
+
_excluded3 = ["reloadDocument", "replace", "state", "method", "action", "onSubmit", "submit", "relative", "preventScrollReset"];
|
|
209
209
|
function createBrowserRouter(routes, opts) {
|
|
210
210
|
return createRouter({
|
|
211
211
|
basename: opts == null ? void 0 : opts.basename,
|
|
@@ -254,11 +254,29 @@ function deserializeErrors(errors) {
|
|
|
254
254
|
if (val && val.__type === "RouteErrorResponse") {
|
|
255
255
|
serialized[key] = new ErrorResponse(val.status, val.statusText, val.data, val.internal === true);
|
|
256
256
|
} else if (val && val.__type === "Error") {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
// Attempt to reconstruct the right type of Error (i.e., ReferenceError)
|
|
258
|
+
if (val.__subType) {
|
|
259
|
+
let ErrorConstructor = window[val.__subType];
|
|
260
|
+
if (typeof ErrorConstructor === "function") {
|
|
261
|
+
try {
|
|
262
|
+
// @ts-expect-error
|
|
263
|
+
let error = new ErrorConstructor(val.message);
|
|
264
|
+
// Wipe away the client-side stack trace. Nothing to fill it in with
|
|
265
|
+
// because we don't serialize SSR stack traces for security reasons
|
|
266
|
+
error.stack = "";
|
|
267
|
+
serialized[key] = error;
|
|
268
|
+
} catch (e) {
|
|
269
|
+
// no-op - fall through and create a normal Error
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (serialized[key] == null) {
|
|
274
|
+
let error = new Error(val.message);
|
|
275
|
+
// Wipe away the client-side stack trace. Nothing to fill it in with
|
|
276
|
+
// because we don't serialize SSR stack traces for security reasons
|
|
277
|
+
error.stack = "";
|
|
278
|
+
serialized[key] = error;
|
|
279
|
+
}
|
|
262
280
|
} else {
|
|
263
281
|
serialized[key] = val;
|
|
264
282
|
}
|
|
@@ -562,6 +580,7 @@ const FormImpl = /*#__PURE__*/React.forwardRef((_ref6, forwardedRef) => {
|
|
|
562
580
|
let {
|
|
563
581
|
reloadDocument,
|
|
564
582
|
replace,
|
|
583
|
+
state,
|
|
565
584
|
method = defaultMethod,
|
|
566
585
|
action,
|
|
567
586
|
onSubmit,
|
|
@@ -583,6 +602,7 @@ const FormImpl = /*#__PURE__*/React.forwardRef((_ref6, forwardedRef) => {
|
|
|
583
602
|
submit(submitter || event.currentTarget, {
|
|
584
603
|
method: submitMethod,
|
|
585
604
|
replace,
|
|
605
|
+
state,
|
|
586
606
|
relative,
|
|
587
607
|
preventScrollReset
|
|
588
608
|
});
|
|
@@ -735,6 +755,7 @@ function useSubmit() {
|
|
|
735
755
|
formMethod: options.method || method,
|
|
736
756
|
formEncType: options.encType || encType,
|
|
737
757
|
replace: options.replace,
|
|
758
|
+
state: options.state,
|
|
738
759
|
fromRouteId: currentRouteId
|
|
739
760
|
});
|
|
740
761
|
}, [router, basename, currentRouteId]);
|
|
@@ -963,7 +984,7 @@ function useScrollRestoration(_temp3) {
|
|
|
963
984
|
}
|
|
964
985
|
// try to scroll to the hash
|
|
965
986
|
if (location.hash) {
|
|
966
|
-
let el = document.getElementById(location.hash.slice(1));
|
|
987
|
+
let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));
|
|
967
988
|
if (el) {
|
|
968
989
|
el.scrollIntoView();
|
|
969
990
|
return;
|