@remix-run/router 0.0.0-experimental-e1311612e → 0.0.0-experimental-cffa549a1
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.d.ts +1 -1
- package/dist/router.cjs.js +15 -2
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +14 -3
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +15 -2
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/dist/utils.d.ts +7 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/router.ts +3 -1
- package/utils.ts +12 -0
package/dist/router.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v0.0.0-experimental-
|
|
2
|
+
* @remix-run/router v0.0.0-experimental-cffa549a1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1511,6 +1511,18 @@
|
|
|
1511
1511
|
response.headers.set("X-Remix-Reload-Document", "true");
|
|
1512
1512
|
return response;
|
|
1513
1513
|
};
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* A redirect response that will perform a `history.replaceState` instead of a
|
|
1517
|
+
* `history.pushState` for client-side navigation redirects.
|
|
1518
|
+
* Sets the status code and the `Location` header.
|
|
1519
|
+
* Defaults to "302 Found".
|
|
1520
|
+
*/
|
|
1521
|
+
const replace = (url, init) => {
|
|
1522
|
+
let response = redirect(url, init);
|
|
1523
|
+
response.headers.set("X-Remix-Replace", "true");
|
|
1524
|
+
return response;
|
|
1525
|
+
};
|
|
1514
1526
|
/**
|
|
1515
1527
|
* @private
|
|
1516
1528
|
* Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies
|
|
@@ -3143,7 +3155,7 @@
|
|
|
3143
3155
|
// There's no need to abort on redirects, since we don't detect the
|
|
3144
3156
|
// redirect until the action/loaders have settled
|
|
3145
3157
|
pendingNavigationController = null;
|
|
3146
|
-
let redirectHistoryAction = replace === true ? Action.Replace : Action.Push;
|
|
3158
|
+
let redirectHistoryAction = replace === true || redirect.response.headers.has("X-Remix-Replace") ? Action.Replace : Action.Push;
|
|
3147
3159
|
|
|
3148
3160
|
// Use the incoming submission if provided, fallback on the active one in
|
|
3149
3161
|
// state.navigation
|
|
@@ -5436,6 +5448,7 @@
|
|
|
5436
5448
|
exports.parsePath = parsePath;
|
|
5437
5449
|
exports.redirect = redirect;
|
|
5438
5450
|
exports.redirectDocument = redirectDocument;
|
|
5451
|
+
exports.replace = replace;
|
|
5439
5452
|
exports.resolvePath = resolvePath;
|
|
5440
5453
|
exports.resolveTo = resolveTo;
|
|
5441
5454
|
exports.stripBasename = stripBasename;
|