@remix-run/router 1.3.0-pre.2 → 1.3.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 +5 -13
- package/dist/router.cjs.js +13 -3
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +13 -3
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +13 -3
- 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/package.json +1 -1
- package/router.ts +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
-
## 1.3.0
|
|
3
|
+
## 1.3.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- Added support for navigation blocking APIs ([#9709](https://github.com/remix-run/react-router/pull/9709))
|
|
8
|
-
|
|
9
|
-
## 1.3.0-pre.1
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- Fix scroll reset if a submission redirects ([#9886](https://github.com/remix-run/react-router/pull/9886))
|
|
14
|
-
|
|
15
|
-
## 1.3.0-pre.0
|
|
16
|
-
|
|
17
|
-
### Minor Changes
|
|
18
|
-
|
|
19
|
-
- Expose deferred information from createStaticHandler ([#9760](https://github.com/remix-run/react-router/pull/9760))
|
|
8
|
+
- Expose deferred information from `createStaticHandler` ([#9760](https://github.com/remix-run/react-router/pull/9760))
|
|
20
9
|
|
|
21
10
|
### Patch Changes
|
|
22
11
|
|
|
23
12
|
- Improved absolute redirect url detection in actions/loaders ([#9829](https://github.com/remix-run/react-router/pull/9829))
|
|
24
13
|
- Fix URL creation with memory histories ([#9814](https://github.com/remix-run/react-router/pull/9814))
|
|
25
14
|
- Fix `generatePath` when optional params are present ([#9764](https://github.com/remix-run/react-router/pull/9764))
|
|
15
|
+
- Fix scroll reset if a submission redirects ([#9886](https://github.com/remix-run/react-router/pull/9886))
|
|
16
|
+
- Fix 404 bug with same-origin absolute redirects ([#9913](https://github.com/remix-run/react-router/pull/9913))
|
|
17
|
+
- Support `OPTIONS` requests in `staticHandler.queryRoute` ([#9914](https://github.com/remix-run/react-router/pull/9914))
|
|
26
18
|
|
|
27
19
|
## 1.2.1
|
|
28
20
|
|
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.3.0
|
|
2
|
+
* @remix-run/router v1.3.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2556,7 +2556,7 @@ function createRouter(init) {
|
|
|
2556
2556
|
} : {}));
|
|
2557
2557
|
invariant(redirectLocation, "Expected a location on the redirect navigation"); // Check if this an external redirect that goes to a new origin
|
|
2558
2558
|
|
|
2559
|
-
if (typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
2559
|
+
if (isBrowser && typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
2560
2560
|
let newOrigin = init.history.createURL(redirect.location).origin;
|
|
2561
2561
|
|
|
2562
2562
|
if (window.location.origin !== newOrigin) {
|
|
@@ -3036,7 +3036,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3036
3036
|
let location = createLocation("", createPath(url), null, "default");
|
|
3037
3037
|
let matches = matchRoutes(dataRoutes, location, basename); // SSR supports HEAD requests while SPA doesn't
|
|
3038
3038
|
|
|
3039
|
-
if (!isValidMethod(method) && method !== "head") {
|
|
3039
|
+
if (!isValidMethod(method) && method !== "head" && method !== "options") {
|
|
3040
3040
|
throw getInternalRouterError(405, {
|
|
3041
3041
|
method
|
|
3042
3042
|
});
|
|
@@ -3552,6 +3552,16 @@ async function callLoaderOrAction(type, request, match, matches, basename, isSta
|
|
|
3552
3552
|
}
|
|
3553
3553
|
|
|
3554
3554
|
location = createPath(resolvedLocation);
|
|
3555
|
+
} else if (!isStaticRequest) {
|
|
3556
|
+
// Strip off the protocol+origin for same-origin absolute redirects.
|
|
3557
|
+
// If this is a static reques, we can let it go back to the browser
|
|
3558
|
+
// as-is
|
|
3559
|
+
let currentUrl = new URL(request.url);
|
|
3560
|
+
let url = location.startsWith("//") ? new URL(currentUrl.protocol + location) : new URL(location);
|
|
3561
|
+
|
|
3562
|
+
if (url.origin === currentUrl.origin) {
|
|
3563
|
+
location = url.pathname + url.search + url.hash;
|
|
3564
|
+
}
|
|
3555
3565
|
} // Don't process redirects in the router during static requests requests.
|
|
3556
3566
|
// Instead, throw the Response and let the server handle it with an HTTP
|
|
3557
3567
|
// redirect. We also update the Location header in place in this flow so
|