@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.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
|
*
|
|
@@ -1236,6 +1236,17 @@ const redirectDocument = (url, init) => {
|
|
|
1236
1236
|
response.headers.set("X-Remix-Reload-Document", "true");
|
|
1237
1237
|
return response;
|
|
1238
1238
|
};
|
|
1239
|
+
/**
|
|
1240
|
+
* A redirect response that will perform a `history.replaceState` instead of a
|
|
1241
|
+
* `history.pushState` for client-side navigation redirects.
|
|
1242
|
+
* Sets the status code and the `Location` header.
|
|
1243
|
+
* Defaults to "302 Found".
|
|
1244
|
+
*/
|
|
1245
|
+
const replace = (url, init) => {
|
|
1246
|
+
let response = redirect(url, init);
|
|
1247
|
+
response.headers.set("X-Remix-Replace", "true");
|
|
1248
|
+
return response;
|
|
1249
|
+
};
|
|
1239
1250
|
/**
|
|
1240
1251
|
* @private
|
|
1241
1252
|
* Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies
|
|
@@ -2698,7 +2709,7 @@ function createRouter(init) {
|
|
|
2698
2709
|
// There's no need to abort on redirects, since we don't detect the
|
|
2699
2710
|
// redirect until the action/loaders have settled
|
|
2700
2711
|
pendingNavigationController = null;
|
|
2701
|
-
let redirectHistoryAction = replace === true ? Action.Replace : Action.Push;
|
|
2712
|
+
let redirectHistoryAction = replace === true || redirect.response.headers.has("X-Remix-Replace") ? Action.Replace : Action.Push;
|
|
2702
2713
|
// Use the incoming submission if provided, fallback on the active one in
|
|
2703
2714
|
// state.navigation
|
|
2704
2715
|
let {
|
|
@@ -4881,5 +4892,5 @@ function persistAppliedTransitions(_window, transitions) {
|
|
|
4881
4892
|
}
|
|
4882
4893
|
//#endregion
|
|
4883
4894
|
|
|
4884
|
-
export { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, resolvePath, resolveTo, stripBasename };
|
|
4895
|
+
export { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, replace, resolvePath, resolveTo, stripBasename };
|
|
4885
4896
|
//# sourceMappingURL=router.js.map
|