-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
fix(router): consistent scroll behavior for Link/Router#push #20606
Conversation
This pull request makes `Router#push` and `Router#replace` function identically to `<Link />`, i.e. reset scroll when the new render is complete. Users can opt out of this new behavior via: ```tsx const path = '/my-page' router.push(path, path, { scroll: false }) ``` --- Fixes vercel#3249
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
buildDuration | 8.9s | 8.8s | -99ms |
nodeModulesSize | 83 MB | 83 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.769 | 1.767 | 0 |
/ avg req/sec | 1413.48 | 1415.09 | +1.61 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.125 | 1.075 | -0.05 |
/error-in-render avg req/sec | 2221.83 | 2324.62 | +102.79 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
677f882d2ed8..0acf.js gzip | 12.8 kB | 12.8 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-29e0222..8425.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 | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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-21c7af4..bddc.js gzip | 1.6 kB | 1.6 kB | ✓ |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.04 kB | 8.04 kB | ✓ |
Client Build Manifests
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
_buildManifest.js gzip | 320 B | 320 B | ✓ |
Overall change | 320 B | 320 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
index.html gzip | 615 B | 615 B | ✓ |
link.html gzip | 621 B | 622 B | |
withRouter.html gzip | 609 B | 609 B | ✓ |
Overall change | 1.84 kB | 1.85 kB |
Diffs
Diff for 677f882d2ed8..de18d87d3.js
@@ -1754,7 +1754,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
) {
var _this2 = this;
- var localeChange,
+ var _options$scroll,
+ localeChange,
parsedAs,
localePathResult,
didNavigate,
@@ -1810,10 +1811,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return _context.abrupt("return", false);
case 3:
+ // Default to scroll reset behavior unless explicitly specified to be
+ // `false`! This makes the behavior between using `Router#push` and a
+ // `<Link />` consistent.
+ options.scroll = !!((_options$scroll =
+ options.scroll) != null
+ ? _options$scroll
+ : true);
localeChange = options.locale !== this.locale;
if (true) {
- _context.next = 16;
+ _context.next = 17;
break;
}
@@ -1866,7 +1874,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
if (!didNavigate) {
- _context.next = 16;
+ _context.next = 17;
break;
}
@@ -1875,7 +1883,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
new Promise(function() {})
);
- case 16:
+ case 17:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1920,7 +1928,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 32;
+ _context.next = 33;
break;
}
@@ -1941,7 +1949,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
return _context.abrupt("return", true);
- case 32:
+ case 33:
parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
url
);
@@ -1951,30 +1959,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// get their query parameters to allow ensuring they can be parsed properly
// when rewritten to
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 35;
+ _context.next = 38;
return this.pageLoader.getPageList();
- case 37:
+ case 38:
pages = _context.sent;
- _context.next = 40;
+ _context.next = 41;
return (0, _routeLoader.getClientBuildManifest)();
- case 40:
+ case 41:
_yield = _context.sent;
rewrites = _yield.__rewrites;
- _context.next = 48;
+ _context.next = 49;
break;
- case 44:
- _context.prev = 44;
- _context.t0 = _context["catch"](34);
+ case 45:
+ _context.prev = 45;
+ _context.t0 = _context["catch"](35);
// If we fail to resolve the page list or client-build manifest, we must
// do a server-side transition:
window.location.href = as;
return _context.abrupt("return", false);
- case 48:
+ case 49:
parsed = this._resolveHref(parsed, pages);
if (parsed.pathname !== pathname) {
@@ -2016,7 +2024,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 71;
+ _context.next = 72;
break;
}
@@ -2039,7 +2047,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
(shouldInterpolate && !interpolatedAs.result)
)
) {
- _context.next = 70;
+ _context.next = 71;
break;
}
@@ -2050,7 +2058,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 68;
+ _context.next = 69;
break;
}
@@ -2081,11 +2089,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)
);
- case 68:
- _context.next = 71;
+ case 69:
+ _context.next = 72;
break;
- case 70:
+ case 71:
if (shouldInterpolate) {
as = (0, _utils.formatWithValidation)(
Object.assign({}, _parsedAs, {
@@ -2101,14 +2109,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Object.assign(query, routeMatch);
}
- case 71:
+ case 72:
Router.events.emit(
"routeChangeStart",
as,
routeProps
);
- _context.prev = 72;
- _context.next = 75;
+ _context.prev = 73;
+ _context.next = 76;
return this.getRouteInfo(
route,
pathname,
@@ -2117,7 +2125,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeProps
);
- case 75:
+ case 76:
routeInfo = _context.sent;
(_routeInfo = routeInfo),
(error = _routeInfo.error),
@@ -2126,14 +2134,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
(__N_SSP = _routeInfo.__N_SSP); // handle redirect on client-transition
if (!((__N_SSG || __N_SSP) && props)) {
- _context.next = 102;
+ _context.next = 103;
break;
}
if (
!(props.pageProps && props.pageProps.__N_REDIRECT)
) {
- _context.next = 88;
+ _context.next = 89;
break;
}
@@ -2142,7 +2150,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// it's not
if (!destination.startsWith("/")) {
- _context.next = 86;
+ _context.next = 87;
break;
}
@@ -2152,7 +2160,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this._resolveHref(parsedHref, pages, false);
if (!pages.includes(parsedHref.pathname)) {
- _context.next = 86;
+ _context.next = 87;
break;
}
@@ -2168,35 +2176,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this.change(method, newUrl, newAs, options)
);
- case 86:
+ case 87:
window.location.href = destination;
return _context.abrupt(
"return",
new Promise(function() {})
);
- case 88:
+ case 89:
if (!(props.notFound === SSG_DATA_NOT_FOUND)) {
- _context.next = 102;
+ _context.next = 103;
break;
}
- _context.prev = 89;
- _context.next = 92;
+ _context.prev = 90;
+ _context.next = 93;
return this.fetchComponent("/404");
- case 92:
+ case 93:
notFoundRoute = "/404";
- _context.next = 98;
+ _context.next = 99;
break;
- case 95:
- _context.prev = 95;
- _context.t1 = _context["catch"](89);
+ case 96:
+ _context.prev = 96;
+ _context.t1 = _context["catch"](90);
notFoundRoute = "/_error";
- case 98:
- _context.next = 100;
+ case 99:
+ _context.next = 101;
return this.getRouteInfo(
notFoundRoute,
notFoundRoute,
@@ -2207,11 +2215,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
);
- case 100:
+ case 101:
routeInfo = _context.sent;
console.log("using routeInfo", routeInfo);
- case 102:
+ case 103:
Router.events.emit(
"beforeHistoryChange",
as,
@@ -2222,7 +2230,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 107;
+ _context.next = 108;
return this.set(
route,
pathname,
@@ -2235,9 +2243,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 107:
+ case 108:
if (!error) {
- _context.next = 110;
+ _context.next = 111;
break;
}
@@ -2249,7 +2257,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 110:
+ case 111:
if (false) {
}
@@ -2263,21 +2271,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
return _context.abrupt("return", true);
- case 116:
- _context.prev = 116;
- _context.t2 = _context["catch"](72);
+ case 117:
+ _context.prev = 117;
+ _context.t2 = _context["catch"](73);
if (!_context.t2.cancelled) {
- _context.next = 120;
+ _context.next = 121;
break;
}
return _context.abrupt("return", false);
- case 120:
+ case 121:
throw _context.t2;
- case 121:
+ case 122:
case "end":
return _context.stop();
}
@@ -2286,9 +2294,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_callee,
this,
[
- [34, 44],
- [72, 116],
- [89, 95]
+ [35, 45],
+ [73, 117],
+ [90, 96]
]
);
})
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
buildDuration | 10.5s | 10.6s | |
nodeModulesSize | 83 MB | 83 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
677f882d2ed8..0acf.js gzip | 12.8 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-29e0222..8425.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-7193..1446.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..769b.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 | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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-21c7af4..bddc.js gzip | 1.6 kB | 1.6 kB | ✓ |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.04 kB | 8.04 kB | ✓ |
Client Build Manifests
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
_buildManifest.js gzip | 320 B | 320 B | ✓ |
Overall change | 320 B | 320 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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 |
This comment has been minimized.
This comment has been minimized.
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
buildDuration | 11.6s | 11.2s | -376ms |
nodeModulesSize | 83 MB | 83 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.449 | 2.448 | 0 |
/ avg req/sec | 1020.68 | 1021.36 | +0.68 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.723 | 1.694 | -0.03 |
/error-in-render avg req/sec | 1450.78 | 1475.96 | +25.18 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
677f882d2ed8..0acf.js gzip | 12.8 kB | 12.8 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-29e0222..8425.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 | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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-21c7af4..bddc.js gzip | 1.6 kB | 1.6 kB | ✓ |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.04 kB | 8.04 kB | ✓ |
Client Build Manifests
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
_buildManifest.js gzip | 320 B | 320 B | ✓ |
Overall change | 320 B | 320 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
index.html gzip | 615 B | 615 B | ✓ |
link.html gzip | 621 B | 622 B | |
withRouter.html gzip | 609 B | 609 B | ✓ |
Overall change | 1.84 kB | 1.85 kB |
Diffs
Diff for 677f882d2ed8..de18d87d3.js
@@ -1754,7 +1754,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
) {
var _this2 = this;
- var localeChange,
+ var _options$scroll,
+ localeChange,
parsedAs,
localePathResult,
didNavigate,
@@ -1810,10 +1811,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return _context.abrupt("return", false);
case 3:
+ // Default to scroll reset behavior unless explicitly specified to be
+ // `false`! This makes the behavior between using `Router#push` and a
+ // `<Link />` consistent.
+ options.scroll = !!((_options$scroll =
+ options.scroll) != null
+ ? _options$scroll
+ : true);
localeChange = options.locale !== this.locale;
if (true) {
- _context.next = 16;
+ _context.next = 17;
break;
}
@@ -1866,7 +1874,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
if (!didNavigate) {
- _context.next = 16;
+ _context.next = 17;
break;
}
@@ -1875,7 +1883,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
new Promise(function() {})
);
- case 16:
+ case 17:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1920,7 +1928,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 32;
+ _context.next = 33;
break;
}
@@ -1941,7 +1949,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
return _context.abrupt("return", true);
- case 32:
+ case 33:
parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
url
);
@@ -1951,30 +1959,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// get their query parameters to allow ensuring they can be parsed properly
// when rewritten to
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 35;
+ _context.next = 38;
return this.pageLoader.getPageList();
- case 37:
+ case 38:
pages = _context.sent;
- _context.next = 40;
+ _context.next = 41;
return (0, _routeLoader.getClientBuildManifest)();
- case 40:
+ case 41:
_yield = _context.sent;
rewrites = _yield.__rewrites;
- _context.next = 48;
+ _context.next = 49;
break;
- case 44:
- _context.prev = 44;
- _context.t0 = _context["catch"](34);
+ case 45:
+ _context.prev = 45;
+ _context.t0 = _context["catch"](35);
// If we fail to resolve the page list or client-build manifest, we must
// do a server-side transition:
window.location.href = as;
return _context.abrupt("return", false);
- case 48:
+ case 49:
parsed = this._resolveHref(parsed, pages);
if (parsed.pathname !== pathname) {
@@ -2016,7 +2024,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 71;
+ _context.next = 72;
break;
}
@@ -2039,7 +2047,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
(shouldInterpolate && !interpolatedAs.result)
)
) {
- _context.next = 70;
+ _context.next = 71;
break;
}
@@ -2050,7 +2058,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 68;
+ _context.next = 69;
break;
}
@@ -2081,11 +2089,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)
);
- case 68:
- _context.next = 71;
+ case 69:
+ _context.next = 72;
break;
- case 70:
+ case 71:
if (shouldInterpolate) {
as = (0, _utils.formatWithValidation)(
Object.assign({}, _parsedAs, {
@@ -2101,14 +2109,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Object.assign(query, routeMatch);
}
- case 71:
+ case 72:
Router.events.emit(
"routeChangeStart",
as,
routeProps
);
- _context.prev = 72;
- _context.next = 75;
+ _context.prev = 73;
+ _context.next = 76;
return this.getRouteInfo(
route,
pathname,
@@ -2117,7 +2125,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeProps
);
- case 75:
+ case 76:
routeInfo = _context.sent;
(_routeInfo = routeInfo),
(error = _routeInfo.error),
@@ -2126,14 +2134,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
(__N_SSP = _routeInfo.__N_SSP); // handle redirect on client-transition
if (!((__N_SSG || __N_SSP) && props)) {
- _context.next = 102;
+ _context.next = 103;
break;
}
if (
!(props.pageProps && props.pageProps.__N_REDIRECT)
) {
- _context.next = 88;
+ _context.next = 89;
break;
}
@@ -2142,7 +2150,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// it's not
if (!destination.startsWith("/")) {
- _context.next = 86;
+ _context.next = 87;
break;
}
@@ -2152,7 +2160,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this._resolveHref(parsedHref, pages, false);
if (!pages.includes(parsedHref.pathname)) {
- _context.next = 86;
+ _context.next = 87;
break;
}
@@ -2168,35 +2176,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this.change(method, newUrl, newAs, options)
);
- case 86:
+ case 87:
window.location.href = destination;
return _context.abrupt(
"return",
new Promise(function() {})
);
- case 88:
+ case 89:
if (!(props.notFound === SSG_DATA_NOT_FOUND)) {
- _context.next = 102;
+ _context.next = 103;
break;
}
- _context.prev = 89;
- _context.next = 92;
+ _context.prev = 90;
+ _context.next = 93;
return this.fetchComponent("/404");
- case 92:
+ case 93:
notFoundRoute = "/404";
- _context.next = 98;
+ _context.next = 99;
break;
- case 95:
- _context.prev = 95;
- _context.t1 = _context["catch"](89);
+ case 96:
+ _context.prev = 96;
+ _context.t1 = _context["catch"](90);
notFoundRoute = "/_error";
- case 98:
- _context.next = 100;
+ case 99:
+ _context.next = 101;
return this.getRouteInfo(
notFoundRoute,
notFoundRoute,
@@ -2207,11 +2215,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
);
- case 100:
+ case 101:
routeInfo = _context.sent;
console.log("using routeInfo", routeInfo);
- case 102:
+ case 103:
Router.events.emit(
"beforeHistoryChange",
as,
@@ -2222,7 +2230,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 107;
+ _context.next = 108;
return this.set(
route,
pathname,
@@ -2235,9 +2243,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 107:
+ case 108:
if (!error) {
- _context.next = 110;
+ _context.next = 111;
break;
}
@@ -2249,7 +2257,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 110:
+ case 111:
if (false) {
}
@@ -2263,21 +2271,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
return _context.abrupt("return", true);
- case 116:
- _context.prev = 116;
- _context.t2 = _context["catch"](72);
+ case 117:
+ _context.prev = 117;
+ _context.t2 = _context["catch"](73);
if (!_context.t2.cancelled) {
- _context.next = 120;
+ _context.next = 121;
break;
}
return _context.abrupt("return", false);
- case 120:
+ case 121:
throw _context.t2;
- case 121:
+ case 122:
case "end":
return _context.stop();
}
@@ -2286,9 +2294,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_callee,
this,
[
- [34, 44],
- [72, 116],
- [89, 95]
+ [35, 45],
+ [73, 117],
+ [90, 96]
]
);
})
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
buildDuration | 13.6s | 13.9s | |
nodeModulesSize | 83 MB | 83 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
677f882d2ed8..0acf.js gzip | 12.8 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-29e0222..8425.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-7193..1446.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..769b.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 | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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-21c7af4..bddc.js gzip | 1.6 kB | 1.6 kB | ✓ |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.04 kB | 8.04 kB | ✓ |
Client Build Manifests
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
_buildManifest.js gzip | 320 B | 320 B | ✓ |
Overall change | 320 B | 320 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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 |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
buildDuration | 10.7s | 10.8s | |
nodeModulesSize | 83 MB | 83 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.147 | 2.099 | -0.05 |
/ avg req/sec | 1164.49 | 1191.32 | +26.83 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.437 | 1.365 | -0.07 |
/error-in-render avg req/sec | 1739.39 | 1831.55 | +92.16 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
677f882d2ed8..0acf.js gzip | 12.8 kB | 12.8 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-29e0222..8425.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 | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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-21c7af4..bddc.js gzip | 1.6 kB | 1.6 kB | ✓ |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.04 kB | 8.04 kB | ✓ |
Client Build Manifests
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
_buildManifest.js gzip | 320 B | 320 B | ✓ |
Overall change | 320 B | 320 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
index.html gzip | 615 B | 615 B | ✓ |
link.html gzip | 621 B | 622 B | |
withRouter.html gzip | 609 B | 609 B | ✓ |
Overall change | 1.84 kB | 1.85 kB |
Diffs
Diff for 677f882d2ed8..de18d87d3.js
@@ -1754,7 +1754,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
) {
var _this2 = this;
- var localeChange,
+ var _options$scroll,
+ localeChange,
parsedAs,
localePathResult,
didNavigate,
@@ -1810,10 +1811,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return _context.abrupt("return", false);
case 3:
+ // Default to scroll reset behavior unless explicitly specified to be
+ // `false`! This makes the behavior between using `Router#push` and a
+ // `<Link />` consistent.
+ options.scroll = !!((_options$scroll =
+ options.scroll) != null
+ ? _options$scroll
+ : true);
localeChange = options.locale !== this.locale;
if (true) {
- _context.next = 16;
+ _context.next = 17;
break;
}
@@ -1866,7 +1874,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
if (!didNavigate) {
- _context.next = 16;
+ _context.next = 17;
break;
}
@@ -1875,7 +1883,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
new Promise(function() {})
);
- case 16:
+ case 17:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1920,7 +1928,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 32;
+ _context.next = 33;
break;
}
@@ -1941,7 +1949,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
return _context.abrupt("return", true);
- case 32:
+ case 33:
parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
url
);
@@ -1951,30 +1959,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// get their query parameters to allow ensuring they can be parsed properly
// when rewritten to
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 35;
+ _context.next = 38;
return this.pageLoader.getPageList();
- case 37:
+ case 38:
pages = _context.sent;
- _context.next = 40;
+ _context.next = 41;
return (0, _routeLoader.getClientBuildManifest)();
- case 40:
+ case 41:
_yield = _context.sent;
rewrites = _yield.__rewrites;
- _context.next = 48;
+ _context.next = 49;
break;
- case 44:
- _context.prev = 44;
- _context.t0 = _context["catch"](34);
+ case 45:
+ _context.prev = 45;
+ _context.t0 = _context["catch"](35);
// If we fail to resolve the page list or client-build manifest, we must
// do a server-side transition:
window.location.href = as;
return _context.abrupt("return", false);
- case 48:
+ case 49:
parsed = this._resolveHref(parsed, pages);
if (parsed.pathname !== pathname) {
@@ -2016,7 +2024,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 71;
+ _context.next = 72;
break;
}
@@ -2039,7 +2047,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
(shouldInterpolate && !interpolatedAs.result)
)
) {
- _context.next = 70;
+ _context.next = 71;
break;
}
@@ -2050,7 +2058,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 68;
+ _context.next = 69;
break;
}
@@ -2081,11 +2089,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)
);
- case 68:
- _context.next = 71;
+ case 69:
+ _context.next = 72;
break;
- case 70:
+ case 71:
if (shouldInterpolate) {
as = (0, _utils.formatWithValidation)(
Object.assign({}, _parsedAs, {
@@ -2101,14 +2109,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Object.assign(query, routeMatch);
}
- case 71:
+ case 72:
Router.events.emit(
"routeChangeStart",
as,
routeProps
);
- _context.prev = 72;
- _context.next = 75;
+ _context.prev = 73;
+ _context.next = 76;
return this.getRouteInfo(
route,
pathname,
@@ -2117,7 +2125,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeProps
);
- case 75:
+ case 76:
routeInfo = _context.sent;
(_routeInfo = routeInfo),
(error = _routeInfo.error),
@@ -2126,14 +2134,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
(__N_SSP = _routeInfo.__N_SSP); // handle redirect on client-transition
if (!((__N_SSG || __N_SSP) && props)) {
- _context.next = 102;
+ _context.next = 103;
break;
}
if (
!(props.pageProps && props.pageProps.__N_REDIRECT)
) {
- _context.next = 88;
+ _context.next = 89;
break;
}
@@ -2142,7 +2150,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// it's not
if (!destination.startsWith("/")) {
- _context.next = 86;
+ _context.next = 87;
break;
}
@@ -2152,7 +2160,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this._resolveHref(parsedHref, pages, false);
if (!pages.includes(parsedHref.pathname)) {
- _context.next = 86;
+ _context.next = 87;
break;
}
@@ -2168,35 +2176,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this.change(method, newUrl, newAs, options)
);
- case 86:
+ case 87:
window.location.href = destination;
return _context.abrupt(
"return",
new Promise(function() {})
);
- case 88:
+ case 89:
if (!(props.notFound === SSG_DATA_NOT_FOUND)) {
- _context.next = 102;
+ _context.next = 103;
break;
}
- _context.prev = 89;
- _context.next = 92;
+ _context.prev = 90;
+ _context.next = 93;
return this.fetchComponent("/404");
- case 92:
+ case 93:
notFoundRoute = "/404";
- _context.next = 98;
+ _context.next = 99;
break;
- case 95:
- _context.prev = 95;
- _context.t1 = _context["catch"](89);
+ case 96:
+ _context.prev = 96;
+ _context.t1 = _context["catch"](90);
notFoundRoute = "/_error";
- case 98:
- _context.next = 100;
+ case 99:
+ _context.next = 101;
return this.getRouteInfo(
notFoundRoute,
notFoundRoute,
@@ -2207,11 +2215,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
);
- case 100:
+ case 101:
routeInfo = _context.sent;
console.log("using routeInfo", routeInfo);
- case 102:
+ case 103:
Router.events.emit(
"beforeHistoryChange",
as,
@@ -2222,7 +2230,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 107;
+ _context.next = 108;
return this.set(
route,
pathname,
@@ -2235,9 +2243,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 107:
+ case 108:
if (!error) {
- _context.next = 110;
+ _context.next = 111;
break;
}
@@ -2249,7 +2257,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 110:
+ case 111:
if (false) {
}
@@ -2263,21 +2271,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
return _context.abrupt("return", true);
- case 116:
- _context.prev = 116;
- _context.t2 = _context["catch"](72);
+ case 117:
+ _context.prev = 117;
+ _context.t2 = _context["catch"](73);
if (!_context.t2.cancelled) {
- _context.next = 120;
+ _context.next = 121;
break;
}
return _context.abrupt("return", false);
- case 120:
+ case 121:
throw _context.t2;
- case 121:
+ case 122:
case "end":
return _context.stop();
}
@@ -2286,9 +2294,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_callee,
this,
[
- [34, 44],
- [72, 116],
- [89, 95]
+ [35, 45],
+ [73, 117],
+ [90, 96]
]
);
})
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f7d43de64a3bd7c5e682.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
buildDuration | 13.3s | 13.1s | -192ms |
nodeModulesSize | 83 MB | 83 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
677f882d2ed8..0acf.js gzip | 12.8 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-29e0222..8425.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-7193..1446.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..769b.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 | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
polyfills-67..b7d1.js gzip | 31.2 kB | 31.2 kB | ✓ |
Overall change | 31.2 kB | 31.2 kB | ✓ |
Client Pages
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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-21c7af4..bddc.js gzip | 1.6 kB | 1.6 kB | ✓ |
routerDirect..bd82.js gzip | 303 B | 303 B | ✓ |
withRouter-2..e384.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.04 kB | 8.04 kB | ✓ |
Client Build Manifests
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | Change | |
---|---|---|---|
_buildManifest.js gzip | 320 B | 320 B | ✓ |
Overall change | 320 B | 320 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Timer/next.js hotfix/reset-scroll-via-router | 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 |
Are you sure it should scroll up by default even when The update to 10.0.5 caused unwanted scroll-ups for us we had to fix. |
How did you manage to fix this? Facing the same issue at the moment. |
Fixed manually by adding |
This pull request makes
Router#push
andRouter#replace
function identically to<Link />
, i.e. reset scroll when the new render is complete.Users can opt out of this new behavior via:
Fixes #3249