@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/utils.d.ts
CHANGED
|
@@ -500,6 +500,13 @@ export declare const redirect: RedirectFunction;
|
|
|
500
500
|
* Defaults to "302 Found".
|
|
501
501
|
*/
|
|
502
502
|
export declare const redirectDocument: RedirectFunction;
|
|
503
|
+
/**
|
|
504
|
+
* A redirect response that will perform a `history.replaceState` instead of a
|
|
505
|
+
* `history.pushState` for client-side navigation redirects.
|
|
506
|
+
* Sets the status code and the `Location` header.
|
|
507
|
+
* Defaults to "302 Found".
|
|
508
|
+
*/
|
|
509
|
+
export declare const replace: RedirectFunction;
|
|
503
510
|
export type ErrorResponse = {
|
|
504
511
|
status: number;
|
|
505
512
|
statusText: string;
|
package/index.ts
CHANGED
package/package.json
CHANGED
package/router.ts
CHANGED
|
@@ -2683,7 +2683,9 @@ export function createRouter(init: RouterInit): Router {
|
|
|
2683
2683
|
pendingNavigationController = null;
|
|
2684
2684
|
|
|
2685
2685
|
let redirectHistoryAction =
|
|
2686
|
-
replace === true
|
|
2686
|
+
replace === true || redirect.response.headers.has("X-Remix-Replace")
|
|
2687
|
+
? HistoryAction.Replace
|
|
2688
|
+
: HistoryAction.Push;
|
|
2687
2689
|
|
|
2688
2690
|
// Use the incoming submission if provided, fallback on the active one in
|
|
2689
2691
|
// state.navigation
|
package/utils.ts
CHANGED
|
@@ -1619,6 +1619,18 @@ export const redirectDocument: RedirectFunction = (url, init) => {
|
|
|
1619
1619
|
return response;
|
|
1620
1620
|
};
|
|
1621
1621
|
|
|
1622
|
+
/**
|
|
1623
|
+
* A redirect response that will perform a `history.replaceState` instead of a
|
|
1624
|
+
* `history.pushState` for client-side navigation redirects.
|
|
1625
|
+
* Sets the status code and the `Location` header.
|
|
1626
|
+
* Defaults to "302 Found".
|
|
1627
|
+
*/
|
|
1628
|
+
export const replace: RedirectFunction = (url, init) => {
|
|
1629
|
+
let response = redirect(url, init);
|
|
1630
|
+
response.headers.set("X-Remix-Replace", "true");
|
|
1631
|
+
return response;
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1622
1634
|
export type ErrorResponse = {
|
|
1623
1635
|
status: number;
|
|
1624
1636
|
statusText: string;
|