Skip to content
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

Change default SWR delta value to 1 year #70674

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

ijjk
Copy link
Member

@ijjk ijjk commented Oct 1, 2024

As previously discussed we've talked about ensuring this stale-while-revalidate can be consumed by CDNs by default which means we need to have a default SWR delta so this defaults to one year although it can still be customized via the swrDelta config.

One gotcha with this is users when testing locally with next start or there is no CDN consuming the header browsers will consume the header. This gotcha is worth the change as it can be configured and most proper setups should be behind a CDN to consume this header.

@ijjk ijjk added created-by: Next.js team PRs by the Next.js team. Documentation Related to Next.js' official documentation. type: next labels Oct 1, 2024
@ijjk
Copy link
Member Author

ijjk commented Oct 1, 2024

Tests Passed

@ijjk
Copy link
Member Author

ijjk commented Oct 1, 2024

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
buildDuration 21.8s 19.9s N/A
buildDurationCached 19s 16.5s N/A
nodeModulesSize 371 MB 371 MB ⚠️ +488 B
nextStartRea..uration (ms) 482ms 490ms N/A
Client Bundles (main, webpack)
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
1526.HASH.js gzip 170 B 169 B N/A
1698-HASH.js gzip 5.26 kB 5.26 kB N/A
9709-HASH.js gzip 41.8 kB 41.8 kB N/A
d1e65033-HASH.js gzip 52.8 kB 52.8 kB N/A
framework-HASH.js gzip 57.5 kB 57.5 kB N/A
main-app-HASH.js gzip 229 B 230 B N/A
main-HASH.js gzip 32.7 kB 32.7 kB N/A
webpack-HASH.js gzip 1.71 kB 1.71 kB
Overall change 1.71 kB 1.71 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Overall change 39.4 kB 39.4 kB
Client Pages
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
_app-HASH.js gzip 193 B 193 B
_error-HASH.js gzip 192 B 192 B
amp-HASH.js gzip 511 B 512 B N/A
css-HASH.js gzip 343 B 341 B N/A
dynamic-HASH.js gzip 1.84 kB 1.85 kB N/A
edge-ssr-HASH.js gzip 266 B 266 B
head-HASH.js gzip 364 B 363 B N/A
hooks-HASH.js gzip 392 B 389 B N/A
image-HASH.js gzip 4.41 kB 4.41 kB N/A
index-HASH.js gzip 268 B 268 B
link-HASH.js gzip 2.78 kB 2.78 kB N/A
routerDirect..HASH.js gzip 329 B 328 B N/A
script-HASH.js gzip 396 B 396 B
withRouter-HASH.js gzip 325 B 324 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 1.42 kB 1.42 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
_buildManifest.js gzip 746 B 750 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
index.html gzip 524 B 522 B N/A
link.html gzip 540 B 537 B N/A
withRouter.html gzip 520 B 518 B N/A
Overall change 0 B 0 B
Edge SSR bundle Size
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
edge-ssr.js gzip 129 kB 129 kB N/A
page.js gzip 181 kB 182 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
middleware-b..fest.js gzip 668 B 669 B N/A
middleware-r..fest.js gzip 155 B 156 B N/A
middleware.js gzip 30 kB 30 kB N/A
edge-runtime..pack.js gzip 844 B 844 B
Overall change 844 B 844 B
Next Runtimes
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
973-experime...dev.js gzip 322 B 322 B
973.runtime.dev.js gzip 314 B 314 B
app-page-exp...dev.js gzip 319 kB 319 kB
app-page-exp..prod.js gzip 126 kB 126 kB
app-page-tur..prod.js gzip 140 kB 140 kB
app-page-tur..prod.js gzip 134 kB 134 kB
app-page.run...dev.js gzip 309 kB 309 kB
app-page.run..prod.js gzip 122 kB 122 kB
app-route-ex...dev.js gzip 34.1 kB 34.1 kB
app-route-ex..prod.js gzip 22.7 kB 22.7 kB
app-route-tu..prod.js gzip 22.7 kB 22.7 kB
app-route-tu..prod.js gzip 22.4 kB 22.4 kB
app-route.ru...dev.js gzip 35.8 kB 35.8 kB
app-route.ru..prod.js gzip 22.4 kB 22.4 kB
pages-api-tu..prod.js gzip 9.62 kB 9.62 kB
pages-api.ru...dev.js gzip 11.5 kB 11.5 kB
pages-api.ru..prod.js gzip 9.61 kB 9.61 kB
pages-turbo...prod.js gzip 20.9 kB 20.9 kB
pages.runtim...dev.js gzip 26.5 kB 26.5 kB
pages.runtim..prod.js gzip 20.9 kB 20.9 kB
server.runti..prod.js gzip 57.5 kB 57.5 kB
Overall change 1.47 MB 1.47 MB
build cache Overall increase ⚠️
vercel/next.js canary ijjk/next.js ijjk/change-swr-delta Change
0.pack gzip 1.67 MB 1.67 MB ⚠️ +2.93 kB
index.pack gzip 132 kB 132 kB N/A
Overall change 1.67 MB 1.67 MB ⚠️ +2.93 kB
Diff details
Diff for page.js

Diff too large to display

Diff for middleware.js

Diff too large to display

Diff for edge-ssr.js

Diff too large to display

Diff for image-HASH.js
@@ -1,7 +1,7 @@
 (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
   [8358],
   {
-    /***/ 4519: /***/ (
+    /***/ 766: /***/ (
       __unused_webpack_module,
       __unused_webpack_exports,
       __webpack_require__
@@ -9,7 +9,7 @@
       (window.__NEXT_P = window.__NEXT_P || []).push([
         "/image",
         function () {
-          return __webpack_require__(6366);
+          return __webpack_require__(8898);
         },
       ]);
       if (false) {
@@ -18,7 +18,7 @@
       /***/
     },
 
-    /***/ 7847: /***/ (module, exports, __webpack_require__) => {
+    /***/ 8501: /***/ (module, exports, __webpack_require__) => {
       "use strict";
       /* __next_internal_client_entry_do_not_use__  cjs */
       Object.defineProperty(exports, "__esModule", {
@@ -40,17 +40,17 @@
         __webpack_require__(133)
       );
       const _head = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(6142)
+        __webpack_require__(294)
       );
-      const _getimgprops = __webpack_require__(2989);
-      const _imageconfig = __webpack_require__(2948);
-      const _imageconfigcontextsharedruntime = __webpack_require__(3394);
-      const _warnonce = __webpack_require__(6308);
-      const _routercontextsharedruntime = __webpack_require__(932);
+      const _getimgprops = __webpack_require__(2367);
+      const _imageconfig = __webpack_require__(9037);
+      const _imageconfigcontextsharedruntime = __webpack_require__(6876);
+      const _warnonce = __webpack_require__(5603);
+      const _routercontextsharedruntime = __webpack_require__(6967);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(4394)
+        __webpack_require__(5093)
       );
-      const _usemergedref = __webpack_require__(9673);
+      const _usemergedref = __webpack_require__(9386);
       // This is replaced by webpack define plugin
       const configEnv = {
         deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
@@ -371,7 +371,7 @@
       /***/
     },
 
-    /***/ 9673: /***/ (module, exports, __webpack_require__) => {
+    /***/ 9386: /***/ (module, exports, __webpack_require__) => {
       "use strict";
 
       Object.defineProperty(exports, "__esModule", {
@@ -432,7 +432,7 @@
       /***/
     },
 
-    /***/ 2989: /***/ (
+    /***/ 2367: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -448,9 +448,9 @@
           return getImgProps;
         },
       });
-      const _warnonce = __webpack_require__(6308);
-      const _imageblursvg = __webpack_require__(9492);
-      const _imageconfig = __webpack_require__(2948);
+      const _warnonce = __webpack_require__(5603);
+      const _imageblursvg = __webpack_require__(2052);
+      const _imageconfig = __webpack_require__(9037);
       const VALID_LOADING_VALUES =
         /* unused pure expression or super */ null && [
           "lazy",
@@ -823,7 +823,7 @@
       /***/
     },
 
-    /***/ 9492: /***/ (__unused_webpack_module, exports) => {
+    /***/ 2052: /***/ (__unused_webpack_module, exports) => {
       "use strict";
       /**
        * A shared function, used on both client and server, to generate a SVG blur placeholder.
@@ -878,7 +878,7 @@
       /***/
     },
 
-    /***/ 9256: /***/ (
+    /***/ 3038: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -905,10 +905,10 @@
         },
       });
       const _interop_require_default = __webpack_require__(9608);
-      const _getimgprops = __webpack_require__(2989);
-      const _imagecomponent = __webpack_require__(7847);
+      const _getimgprops = __webpack_require__(2367);
+      const _imagecomponent = __webpack_require__(8501);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(4394)
+        __webpack_require__(5093)
       );
       function getImageProps(imgProps) {
         const { props } = (0, _getimgprops.getImgProps)(imgProps, {
@@ -940,7 +940,7 @@
       /***/
     },
 
-    /***/ 4394: /***/ (__unused_webpack_module, exports) => {
+    /***/ 5093: /***/ (__unused_webpack_module, exports) => {
       "use strict";
 
       Object.defineProperty(exports, "__esModule", {
@@ -975,7 +975,7 @@
       /***/
     },
 
-    /***/ 6366: /***/ (
+    /***/ 8898: /***/ (
       __unused_webpack_module,
       __webpack_exports__,
       __webpack_require__
@@ -992,8 +992,8 @@
 
       // EXTERNAL MODULE: ./node_modules/.pnpm/react@19.0.0-rc-2d16326d-20240930/node_modules/react/jsx-runtime.js
       var jsx_runtime = __webpack_require__(9837);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-2d16326d-20240930_re_aw34735d3a4s5ybwraoeym2z3m/node_modules/next/image.js
-      var next_image = __webpack_require__(6020);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-2d16326d-20240930_re_twsodcu6u2xc4vttzu7xhu5gra/node_modules/next/image.js
+      var next_image = __webpack_require__(3843);
       var image_default = /*#__PURE__*/ __webpack_require__.n(next_image); // CONCATENATED MODULE: ./pages/nextjs.png
       /* harmony default export */ const nextjs = {
         src: "/_next/static/media/nextjs.cae0b805.png",
@@ -1023,12 +1023,12 @@
       /***/
     },
 
-    /***/ 6020: /***/ (
+    /***/ 3843: /***/ (
       module,
       __unused_webpack_exports,
       __webpack_require__
     ) => {
-      module.exports = __webpack_require__(9256);
+      module.exports = __webpack_require__(3038);
 
       /***/
     },
@@ -1038,7 +1038,7 @@
     /******/ var __webpack_exec__ = (moduleId) =>
       __webpack_require__((__webpack_require__.s = moduleId));
     /******/ __webpack_require__.O(0, [2888, 9774, 179], () =>
-      __webpack_exec__(4519)
+      __webpack_exec__(766)
     );
     /******/ var __webpack_exports__ = __webpack_require__.O();
     /******/ _N_E = __webpack_exports__;
Diff for 1698-HASH.js
@@ -1,8 +1,8 @@
 "use strict";
 (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
-  [1698],
+  [2859],
   {
-    /***/ 1698: /***/ (module, exports, __webpack_require__) => {
+    /***/ 2859: /***/ (module, exports, __webpack_require__) => {
       /* __next_internal_client_entry_do_not_use__  cjs */
       Object.defineProperty(exports, "__esModule", {
         value: true,
@@ -13,27 +13,27 @@
           return Image;
         },
       });
-      const _interop_require_default = __webpack_require__(3280);
-      const _interop_require_wildcard = __webpack_require__(8464);
-      const _jsxruntime = __webpack_require__(673);
+      const _interop_require_default = __webpack_require__(9218);
+      const _interop_require_wildcard = __webpack_require__(8553);
+      const _jsxruntime = __webpack_require__(9348);
       const _react = /*#__PURE__*/ _interop_require_wildcard._(
-        __webpack_require__(254)
+        __webpack_require__(8196)
       );
       const _reactdom = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(177)
+        __webpack_require__(8174)
       );
       const _head = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(4591)
+        __webpack_require__(3039)
       );
-      const _getimgprops = __webpack_require__(6509);
-      const _imageconfig = __webpack_require__(1545);
-      const _imageconfigcontextsharedruntime = __webpack_require__(9041);
-      const _warnonce = __webpack_require__(7147);
-      const _routercontextsharedruntime = __webpack_require__(7112);
+      const _getimgprops = __webpack_require__(4645);
+      const _imageconfig = __webpack_require__(8661);
+      const _imageconfigcontextsharedruntime = __webpack_require__(5611);
+      const _warnonce = __webpack_require__(3975);
+      const _routercontextsharedruntime = __webpack_require__(4332);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(4980)
+        __webpack_require__(9206)
       );
-      const _usemergedref = __webpack_require__(3096);
+      const _usemergedref = __webpack_require__(900);
       // This is replaced by webpack define plugin
       const configEnv = {
         deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
@@ -355,7 +355,7 @@
       /***/
     },
 
-    /***/ 3096: /***/ (module, exports, __webpack_require__) => {
+    /***/ 900: /***/ (module, exports, __webpack_require__) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -365,7 +365,7 @@
           return useMergedRef;
         },
       });
-      const _react = __webpack_require__(254);
+      const _react = __webpack_require__(8196);
       function useMergedRef(refA, refB) {
         const cleanupA = (0, _react.useRef)(() => {});
         const cleanupB = (0, _react.useRef)(() => {});
@@ -414,7 +414,7 @@
       /***/
     },
 
-    /***/ 5225: /***/ (
+    /***/ 4551: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -428,9 +428,9 @@
           return AmpStateContext;
         },
       });
-      const _interop_require_default = __webpack_require__(3280);
+      const _interop_require_default = __webpack_require__(9218);
       const _react = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(254)
+        __webpack_require__(8196)
       );
       const AmpStateContext = _react.default.createContext({});
       if (false) {
@@ -439,7 +439,7 @@
       /***/
     },
 
-    /***/ 4457: /***/ (__unused_webpack_module, exports) => {
+    /***/ 7094: /***/ (__unused_webpack_module, exports) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -461,7 +461,7 @@
       /***/
     },
 
-    /***/ 6509: /***/ (
+    /***/ 4645: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -475,9 +475,9 @@
           return getImgProps;
         },
       });
-      const _warnonce = __webpack_require__(7147);
-      const _imageblursvg = __webpack_require__(5901);
-      const _imageconfig = __webpack_require__(1545);
+      const _warnonce = __webpack_require__(3975);
+      const _imageblursvg = __webpack_require__(3749);
+      const _imageconfig = __webpack_require__(8661);
       const VALID_LOADING_VALUES =
         /* unused pure expression or super */ null && [
           "lazy",
@@ -850,8 +850,8 @@
       /***/
     },
 
-    /***/ 4591: /***/ (module, exports, __webpack_require__) => {
-      /* provided dependency */ var process = __webpack_require__(4784);
+    /***/ 3039: /***/ (module, exports, __webpack_require__) => {
+      /* provided dependency */ var process = __webpack_require__(1482);
       /* __next_internal_client_entry_do_not_use__  cjs */
       Object.defineProperty(exports, "__esModule", {
         value: true,
@@ -872,19 +872,19 @@
           return defaultHead;
         },
       });
-      const _interop_require_default = __webpack_require__(3280);
-      const _interop_require_wildcard = __webpack_require__(8464);
-      const _jsxruntime = __webpack_require__(673);
+      const _interop_require_default = __webpack_require__(9218);
+      const _interop_require_wildcard = __webpack_require__(8553);
+      const _jsxruntime = __webpack_require__(9348);
       const _react = /*#__PURE__*/ _interop_require_wildcard._(
-        __webpack_require__(254)
+        __webpack_require__(8196)
       );
       const _sideeffect = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(31)
+        __webpack_require__(2968)
       );
-      const _ampcontextsharedruntime = __webpack_require__(5225);
-      const _headmanagercontextsharedruntime = __webpack_require__(3382);
-      const _ampmode = __webpack_require__(4457);
-      const _warnonce = __webpack_require__(7147);
+      const _ampcontextsharedruntime = __webpack_require__(4551);
+      const _headmanagercontextsharedruntime = __webpack_require__(452);
+      const _ampmode = __webpack_require__(7094);
+      const _warnonce = __webpack_require__(3975);
       function defaultHead(inAmpMode) {
         if (inAmpMode === void 0) inAmpMode = false;
         const head = [
@@ -1068,7 +1068,7 @@
       /***/
     },
 
-    /***/ 5901: /***/ (__unused_webpack_module, exports) => {
+    /***/ 3749: /***/ (__unused_webpack_module, exports) => {
       /**
        * A shared function, used on both client and server, to generate a SVG blur placeholder.
        */
@@ -1122,7 +1122,7 @@
       /***/
     },
 
-    /***/ 9041: /***/ (
+    /***/ 5611: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -1136,11 +1136,11 @@
           return ImageConfigContext;
         },
       });
-      const _interop_require_default = __webpack_require__(3280);
+      const _interop_require_default = __webpack_require__(9218);
       const _react = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(254)
+        __webpack_require__(8196)
       );
-      const _imageconfig = __webpack_require__(1545);
+      const _imageconfig = __webpack_require__(8661);
       const ImageConfigContext = _react.default.createContext(
         _imageconfig.imageConfigDefault
       );
@@ -1150,7 +1150,7 @@
       /***/
     },
 
-    /***/ 1545: /***/ (__unused_webpack_module, exports) => {
+    /***/ 8661: /***/ (__unused_webpack_module, exports) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -1197,7 +1197,7 @@
       /***/
     },
 
-    /***/ 4980: /***/ (__unused_webpack_module, exports) => {
+    /***/ 9206: /***/ (__unused_webpack_module, exports) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -1230,7 +1230,7 @@
       /***/
     },
 
-    /***/ 7112: /***/ (
+    /***/ 4332: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -1244,9 +1244,9 @@
           return RouterContext;
         },
       });
-      const _interop_require_default = __webpack_require__(3280);
+      const _interop_require_default = __webpack_require__(9218);
       const _react = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(254)
+        __webpack_require__(8196)
       );
       const RouterContext = _react.default.createContext(null);
       if (false) {
@@ -1255,7 +1255,11 @@
       /***/
     },
 
-    /***/ 31: /***/ (__unused_webpack_module, exports, __webpack_require__) => {
+    /***/ 2968: /***/ (
+      __unused_webpack_module,
+      exports,
+      __webpack_require__
+    ) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -1265,7 +1269,7 @@
           return SideEffect;
         },
       });
-      const _react = __webpack_require__(254);
+      const _react = __webpack_require__(8196);
       const isServer = typeof window === "undefined";
       const useClientOnlyLayoutEffect = isServer
         ? () => {}
Diff for 9709-HASH.js

Diff too large to display

Commit: 72236d4

@ijjk ijjk marked this pull request as ready for review October 1, 2024 20:03
@ijjk ijjk changed the title Change default SWR value to 1 year Change default SWR delta value to 1 year Oct 1, 2024
Copy link
Contributor

@flybayer flybayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@ijjk ijjk merged commit b591159 into vercel:canary Oct 1, 2024
86 checks passed
@ijjk ijjk deleted the ijjk/change-swr-delta branch October 1, 2024 22:15
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
created-by: Next.js team PRs by the Next.js team. Documentation Related to Next.js' official documentation. locked type: next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants