-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure href is updated for locale domain #20631
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment has been minimized.
This comment has been minimized.
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
buildDuration | 8.4s | 8.5s | |
nodeModulesSize | 83 MB | 83 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.776 | 1.858 | |
/ avg req/sec | 1407.28 | 1345.82 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.177 | 1.161 | -0.02 |
/error-in-render avg req/sec | 2123.17 | 2153.72 | +30.55 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
677f882d2ed8..6cec.js gzip | 12.8 kB | 12.8 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-b45d971..6435.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-7193..1446.js gzip | 751 B | 751 B | ✓ |
Overall change | 59.1 kB | 59.1 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_app-6220e08..9a40.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-4b0b5..2c91.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-5f309a..7282.js gzip | 887 B | 887 B | ✓ |
index-57f580..c562.js gzip | 227 B | 227 B | ✓ |
link-1a1f628..eeb5.js gzip | 1.61 kB | 1.64 kB | |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.05 kB | 8.08 kB |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 321 B | -1 B |
Overall change | 322 B | 321 B | -1 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
index.html gzip | 617 B | 617 B | ✓ |
link.html gzip | 622 B | 622 B | ✓ |
withRouter.html gzip | 610 B | 611 B | |
Overall change | 1.85 kB | 1.85 kB |
Diffs
Diff for _buildManifest.js
@@ -7,7 +7,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-61cb7b66e376b851f63a.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-93d772b087df6a15801f.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-e404e0ff0d1ed82dadd1.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-a5bdcfc87579b1d2776d.js"
],
Diff for link-93d772b..f6a15801f.js
@@ -284,13 +284,23 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
props.passHref ||
(child.type === "a" && !("href" in child.props))
) {
- childProps.href = (0, _router.addBasePath)(
- (0, _router.addLocale)(
- as,
- typeof locale !== "undefined" ? locale : router && router.locale,
- router && router.defaultLocale
- )
+ var curLocale =
+ typeof locale !== "undefined" ? locale : router && router.locale;
+ var localeDomain = (0, _router.getDomainLocale)(
+ as,
+ curLocale,
+ router && router.locales,
+ router && router.domainLocales
);
+ childProps.href =
+ localeDomain ||
+ (0, _router.addBasePath)(
+ (0, _router.addLocale)(
+ as,
+ curLocale,
+ router && router.defaultLocale
+ )
+ );
}
return /*#__PURE__*/ _react["default"].cloneElement(child, childProps);
Diff for 677f882d2ed8..74301f1c8.js
@@ -1178,6 +1178,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var _slicedToArray = __webpack_require__("J4zp");
exports.__esModule = true;
+ exports.getDomainLocale = getDomainLocale;
exports.addLocale = addLocale;
exports.delLocale = delLocale;
exports.hasBasePath = hasBasePath;
@@ -1245,6 +1246,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: path;
}
+ function getDomainLocale(path, locale, locales, domainLocales) {
+ if (false) {
+ var detectedDomain;
+ }
+
+ return false;
+ }
+
function addLocale(path, locale, defaultLocale) {
if (false) {
}
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
as="script"
/>
<link
@@ -32,7 +32,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-93d772b087df6a15801f.js"
+ href="/_next/static/chunks/pages/link-e404e0ff0d1ed82dadd1.js"
as="script"
/>
</head>
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
async=""
></script>
<script
@@ -78,7 +78,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/pages/link-93d772b087df6a15801f.js"
+ src="/_next/static/chunks/pages/link-e404e0ff0d1ed82dadd1.js"
async=""
></script>
<script src="/_next/static/BUILD_ID/_buildManifest.js" async=""></script>
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
buildDuration | 11.1s | 9.5s | -1.7s |
nodeModulesSize | 83 MB | 83 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
677f882d2ed8..6cec.js gzip | 12.8 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-b45d971..6435.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-7193..1446.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..8a8f.js gzip | N/A | 12.8 kB | N/A |
Overall change | 59.1 kB | 59.1 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_app-6220e08..9a40.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-4b0b5..2c91.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-5f309a..7282.js gzip | 887 B | 887 B | ✓ |
index-57f580..c562.js gzip | 227 B | 227 B | ✓ |
link-1a1f628..eeb5.js gzip | 1.61 kB | N/A | N/A |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
link-b862cd7..dba8.js gzip | N/A | 1.64 kB | N/A |
Overall change | 8.05 kB | 8.08 kB |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 321 B | -1 B |
Overall change | 322 B | 321 B | -1 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_error.js | 1 MB | 1 MB | |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1 MB | 1 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.17 MB | 5.17 MB |
Timer
approved these changes
Dec 31, 2020
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
buildDuration | 9.8s | 9.7s | -63ms |
nodeModulesSize | 83 MB | 83 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.943 | 1.913 | -0.03 |
/ avg req/sec | 1286.98 | 1306.86 | +19.88 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.195 | 1.198 | 0 |
/error-in-render avg req/sec | 2092.39 | 2086.29 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
677f882d2ed8..6cec.js gzip | 12.8 kB | 12.8 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-5b13c61..eaca.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-7193..1446.js gzip | 751 B | 751 B | ✓ |
Overall change | 59.1 kB | 59.1 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_app-6220e08..9a40.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-4b0b5..2c91.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-5f309a..7282.js gzip | 887 B | 887 B | ✓ |
index-57f580..c562.js gzip | 227 B | 227 B | ✓ |
link-1a1f628..eeb5.js gzip | 1.61 kB | 1.64 kB | |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.05 kB | 8.08 kB |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 321 B | -1 B |
Overall change | 322 B | 321 B | -1 B |
Rendered Page Sizes
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
index.html gzip | 617 B | 616 B | -1 B |
link.html gzip | 621 B | 622 B | |
withRouter.html gzip | 610 B | 610 B | ✓ |
Overall change | 1.85 kB | 1.85 kB | ✓ |
Diffs
Diff for _buildManifest.js
@@ -7,7 +7,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-61cb7b66e376b851f63a.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-93d772b087df6a15801f.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-e404e0ff0d1ed82dadd1.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-a5bdcfc87579b1d2776d.js"
],
Diff for link-93d772b..f6a15801f.js
@@ -284,13 +284,23 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
props.passHref ||
(child.type === "a" && !("href" in child.props))
) {
- childProps.href = (0, _router.addBasePath)(
- (0, _router.addLocale)(
- as,
- typeof locale !== "undefined" ? locale : router && router.locale,
- router && router.defaultLocale
- )
+ var curLocale =
+ typeof locale !== "undefined" ? locale : router && router.locale;
+ var localeDomain = (0, _router.getDomainLocale)(
+ as,
+ curLocale,
+ router && router.locales,
+ router && router.domainLocales
);
+ childProps.href =
+ localeDomain ||
+ (0, _router.addBasePath)(
+ (0, _router.addLocale)(
+ as,
+ curLocale,
+ router && router.defaultLocale
+ )
+ );
}
return /*#__PURE__*/ _react["default"].cloneElement(child, childProps);
Diff for 677f882d2ed8..74301f1c8.js
@@ -1178,6 +1178,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var _slicedToArray = __webpack_require__("J4zp");
exports.__esModule = true;
+ exports.getDomainLocale = getDomainLocale;
exports.addLocale = addLocale;
exports.delLocale = delLocale;
exports.hasBasePath = hasBasePath;
@@ -1245,6 +1246,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: path;
}
+ function getDomainLocale(path, locale, locales, domainLocales) {
+ if (false) {
+ var detectedDomain;
+ }
+
+ return false;
+ }
+
function addLocale(path, locale, defaultLocale) {
if (false) {
}
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
as="script"
/>
<link
@@ -32,7 +32,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-93d772b087df6a15801f.js"
+ href="/_next/static/chunks/pages/link-e404e0ff0d1ed82dadd1.js"
as="script"
/>
</head>
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
async=""
></script>
<script
@@ -78,7 +78,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/pages/link-93d772b087df6a15801f.js"
+ src="/_next/static/chunks/pages/link-e404e0ff0d1ed82dadd1.js"
async=""
></script>
<script src="/_next/static/BUILD_ID/_buildManifest.js" async=""></script>
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3bda7895f2274301f1c8.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.bab86a96808e16684765.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
buildDuration | 11.8s | 11.7s | -146ms |
nodeModulesSize | 83 MB | 83 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
677f882d2ed8..6cec.js gzip | 12.8 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-5b13c61..eaca.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-7193..1446.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..8a8f.js gzip | N/A | 12.8 kB | N/A |
Overall change | 59.1 kB | 59.1 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_app-6220e08..9a40.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-4b0b5..2c91.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-5f309a..7282.js gzip | 887 B | 887 B | ✓ |
index-57f580..c562.js gzip | 227 B | 227 B | ✓ |
link-1a1f628..eeb5.js gzip | 1.61 kB | N/A | N/A |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
link-b862cd7..dba8.js gzip | N/A | 1.64 kB | N/A |
Overall change | 8.05 kB | 8.08 kB |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 321 B | -1 B |
Overall change | 322 B | 321 B | -1 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n-domain-links | Change | |
---|---|---|---|
_error.js | 1 MB | 1 MB | |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1 MB | 1 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.17 MB | 5.17 MB |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This ensures we render the locale domain on the
href
when usingnext/link
previously the providedhref
was stilling being rendered which differed from the resultinghref
that was navigated to.Fixes: #20612