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

[ppr] Don't mark RSC requests as /_next/data requests (backport of #66249) #70083

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

wyattjoh
Copy link
Member

This is a backport of #66249 for 14.2.11.

Old logic from the pages router was previously being hit during
development. This was more apparent when PPR was enabled as it was
mixing dynamic + static rendering in development which propagated to
errors. This change ensures that requests that are made with `RSC: 1`
are not marked as `/_next/data` URL's, and don't use the same logic
paths.

Previously it was a bit confusing because we used the variable
`isDataReq` in a few places that made it hard to tell what it was
referring to. In this case, the `isDataReq` is actually only used by the
pages router. This renames the `isDataReq` to `isNextDataRequest` to
make it clearer, as well as refactors to ensure that it's not used in
the paths for app routes.

Also to better represent the rendering modes the `supportsDynamicHTML`
variable was renamed to `supportsDynamicResponse`.

Fixes #66241
@ijjk
Copy link
Member

ijjk commented Sep 13, 2024

Stats from current PR

Default Build (Increase detected ⚠️)
General
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
buildDuration 17.5s 15.9s N/A
buildDurationCached 8.5s 7.7s N/A
nodeModulesSize 200 MB 200 MB N/A
nextStartRea..uration (ms) 415ms 424ms N/A
Client Bundles (main, webpack)
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
1103-HASH.js gzip 31.6 kB 31.6 kB N/A
1a9f679d-HASH.js gzip 53.7 kB 53.7 kB N/A
335-HASH.js gzip 5.05 kB 5.05 kB
7953.HASH.js gzip 181 B 181 B
framework-HASH.js gzip 44.9 kB 44.9 kB
main-app-HASH.js gzip 244 B 244 B
main-HASH.js gzip 32.2 kB 32.3 kB N/A
webpack-HASH.js gzip 1.68 kB 1.68 kB N/A
Overall change 50.3 kB 50.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
_app-HASH.js gzip 195 B 197 B N/A
_error-HASH.js gzip 184 B 184 B
amp-HASH.js gzip 501 B 506 B N/A
css-HASH.js gzip 323 B 324 B N/A
dynamic-HASH.js gzip 1.82 kB 1.82 kB N/A
edge-ssr-HASH.js gzip 259 B 258 B N/A
head-HASH.js gzip 350 B 352 B N/A
hooks-HASH.js gzip 372 B 371 B N/A
image-HASH.js gzip 4.23 kB 4.23 kB
index-HASH.js gzip 259 B 258 B N/A
link-HASH.js gzip 2.68 kB 2.68 kB N/A
routerDirect..HASH.js gzip 316 B 315 B N/A
script-HASH.js gzip 387 B 387 B
withRouter-HASH.js gzip 311 B 310 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 4.9 kB 4.9 kB
Client Build Manifests
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
_buildManifest.js gzip 483 B 483 B
Overall change 483 B 483 B
Rendered Page Sizes
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
index.html gzip 529 B 528 B N/A
link.html gzip 542 B 540 B N/A
withRouter.html gzip 525 B 524 B N/A
Overall change 0 B 0 B
Edge SSR bundle Size
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
edge-ssr.js gzip 95.4 kB 95.3 kB N/A
page.js gzip 3.06 kB 3.06 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
middleware-b..fest.js gzip 659 B 658 B N/A
middleware-r..fest.js gzip 156 B 156 B
middleware.js gzip 25.5 kB 25.5 kB N/A
edge-runtime..pack.js gzip 839 B 839 B
Overall change 995 B 995 B
Next Runtimes
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
app-page-exp...dev.js gzip 171 kB 171 kB N/A
app-page-exp..prod.js gzip 98.1 kB 98.1 kB
app-page-tur..prod.js gzip 99.8 kB 99.8 kB N/A
app-page-tur..prod.js gzip 94.1 kB 94.1 kB N/A
app-page.run...dev.js gzip 145 kB 145 kB
app-page.run..prod.js gzip 92.6 kB 92.6 kB N/A
app-route-ex...dev.js gzip 22 kB 22 kB
app-route-ex..prod.js gzip 15.5 kB 15.5 kB N/A
app-route-tu..prod.js gzip 15.5 kB 15.5 kB N/A
app-route-tu..prod.js gzip 15.2 kB 15.2 kB N/A
app-route.ru...dev.js gzip 21.7 kB 21.7 kB
app-route.ru..prod.js gzip 15.2 kB 15.2 kB
pages-api-tu..prod.js gzip 9.58 kB 9.58 kB
pages-api.ru...dev.js gzip 9.85 kB 9.85 kB
pages-api.ru..prod.js gzip 9.57 kB 9.57 kB
pages-turbo...prod.js gzip 22.5 kB 22.5 kB N/A
pages.runtim...dev.js gzip 23.2 kB 23.2 kB N/A
pages.runtim..prod.js gzip 22.5 kB 22.5 kB N/A
server.runti..prod.js gzip 51.5 kB 51.5 kB N/A
Overall change 331 kB 331 kB
build cache Overall increase ⚠️
vercel/next.js 14-2-1 vercel/next.js backport/b5d911c92c7471efe056c96832fa4b0216d19dad Change
0.pack gzip 1.6 MB 1.61 MB ⚠️ +3.37 kB
index.pack gzip 113 kB 113 kB N/A
Overall change 1.6 MB 1.61 MB ⚠️ +3.37 kB
Diff details
Diff for middleware.js

Diff too large to display

Diff for edge-ssr.js

Diff too large to display

Diff for app-page-exp..ntime.dev.js

Diff too large to display

Diff for app-page-exp..time.prod.js

Diff too large to display

Diff for app-page-tur..time.prod.js

Diff too large to display

Diff for app-page-tur..time.prod.js

Diff too large to display

Diff for app-page.runtime.dev.js

Diff too large to display

Diff for app-page.runtime.prod.js

Diff too large to display

Diff for app-route-ex..ntime.dev.js

Diff too large to display

Diff for app-route-ex..time.prod.js

Diff too large to display

Diff for app-route-tu..time.prod.js

Diff too large to display

Diff for app-route-tu..time.prod.js

Diff too large to display

Diff for app-route.runtime.dev.js

Diff too large to display

Diff for app-route.ru..time.prod.js

Diff too large to display

Diff for pages-turbo...time.prod.js
@@ -19,7 +19,7 @@ Reason: ${n}`)}}function N(e,t,r){if(!T(r))throw new $(e,t,"",`Props must be ret
 
 Keys that need to be moved: ${t.join(", ")}.
 Read more: https://nextjs.org/docs/messages/${r}`};function e2(e,t,r){let{destination:n,permanent:o,statusCode:s,basePath:a}=e,i=[],l=void 0!==s,d=void 0!==o;d&&l?i.push("`permanent` and `statusCode` can not both be provided"):d&&"boolean"!=typeof o?i.push("`permanent` must be `true` or `false`"):l&&!et.has(s)&&i.push(`\`statusCode\` must undefined or one of ${[...et].join(", ")}`);let u=typeof n;"string"!==u&&i.push(`\`destination\` should be string but received ${u}`);let c=typeof a;if("undefined"!==c&&"boolean"!==c&&i.push(`\`basePath\` should be undefined or a false, received ${c}`),i.length>0)throw Error(`Invalid redirect object returned from ${r} for ${t.url}
-`+i.join(" and ")+"\nSee more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp")}async function e3(n,s,a,i,l,d){var u,c,p;let h,f,m,g;(0,x.gk)({req:n},"cookies",(c=n.headers,function(){let{cookie:e}=c;if(!e)return{};let{parse:t}=r("./dist/compiled/cookie/index.js");return t(Array.isArray(e)?e.join("; "):e)}));let v={};if(v.assetQueryString=l.dev&&l.assetQueryString||"",l.dev&&!v.assetQueryString){let e=(n.headers["user-agent"]||"").toLowerCase();e.includes("safari")&&!e.includes("chrome")&&(v.assetQueryString=`?ts=${Date.now()}`)}l.deploymentId&&(v.assetQueryString+=`${v.assetQueryString?"&":"?"}dpl=${l.deploymentId}`),i=Object.assign({},i);let{err:b,dev:w=!1,ampPath:S="",pageConfig:j={},buildManifest:T,reactLoadableManifest:E,ErrorDebug:$,getStaticProps:I,getStaticPaths:k,getServerSideProps:M,isDataReq:D,params:q,previewProps:F,basePath:W,images:Q,runtime:K,isExperimentalCompile:et,swrDelta:es}=l,{App:ea}=d,ei=v.assetQueryString,el=d.Document,ed=l.Component,eu=!!i.__nextFallback,eg=i.__nextNotFoundSrcPage;!function(e){for(let t of ek)delete e[t]}(i);let ev=!!I,ey=ev&&l.nextExport,ex=ea.getInitialProps===ea.origGetInitialProps,eb=!!(null==ed?void 0:ed.getInitialProps),ew=null==ed?void 0:ed.unstable_scriptLoader,eS=G(a),eP="/_error"===a&&ed.getInitialProps===ed.origGetInitialProps;l.nextExport&&eb&&!eP&&t(`Detected getInitialProps on page '${a}' while running export. It's recommended to use getStaticProps which has a more correct behavior for static exporting.
+`+i.join(" and ")+"\nSee more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp")}async function e3(n,s,a,i,l,d){var u,c,p;let h,f,m,g;(0,x.gk)({req:n},"cookies",(c=n.headers,function(){let{cookie:e}=c;if(!e)return{};let{parse:t}=r("./dist/compiled/cookie/index.js");return t(Array.isArray(e)?e.join("; "):e)}));let v={};if(v.assetQueryString=l.dev&&l.assetQueryString||"",l.dev&&!v.assetQueryString){let e=(n.headers["user-agent"]||"").toLowerCase();e.includes("safari")&&!e.includes("chrome")&&(v.assetQueryString=`?ts=${Date.now()}`)}l.deploymentId&&(v.assetQueryString+=`${v.assetQueryString?"&":"?"}dpl=${l.deploymentId}`),i=Object.assign({},i);let{err:b,dev:w=!1,ampPath:S="",pageConfig:j={},buildManifest:T,reactLoadableManifest:E,ErrorDebug:$,getStaticProps:I,getStaticPaths:k,getServerSideProps:M,isNextDataRequest:D,params:q,previewProps:F,basePath:W,images:Q,runtime:K,isExperimentalCompile:et,swrDelta:es}=l,{App:ea}=d,ei=v.assetQueryString,el=d.Document,ed=l.Component,eu=!!i.__nextFallback,eg=i.__nextNotFoundSrcPage;!function(e){for(let t of ek)delete e[t]}(i);let ev=!!I,ey=ev&&l.nextExport,ex=ea.getInitialProps===ea.origGetInitialProps,eb=!!(null==ed?void 0:ed.getInitialProps),ew=null==ed?void 0:ed.unstable_scriptLoader,eS=G(a),eP="/_error"===a&&ed.getInitialProps===ed.origGetInitialProps;l.nextExport&&eb&&!eP&&t(`Detected getInitialProps on page '${a}' while running export. It's recommended to use getStaticProps which has a more correct behavior for static exporting.
 Read more: https://nextjs.org/docs/messages/get-initial-props-export`);let e_=!eb&&ex&&!ev&&!M;if(e_&&!w&&et&&(s.setHeader("Cache-Control",function({revalidate:e,swrDelta:t}){let r=t?`stale-while-revalidate=${t}`:"stale-while-revalidate";return 0===e?"private, no-cache, no-store, max-age=0, must-revalidate":"number"==typeof e?`s-maxage=${e}, ${r}`:`s-maxage=${C.BR}, ${r}`}({revalidate:!1,swrDelta:es})),e_=!1),eb&&ev)throw Error(C.wh+` ${a}`);if(eb&&M)throw Error(C.Wo+` ${a}`);if(M&&ev)throw Error(C.oL+` ${a}`);if(M&&"export"===l.nextConfigOutput)throw Error('getServerSideProps cannot be used with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export');if(k&&!eS)throw Error(`getStaticPaths is only allowed for dynamic SSG pages and was found on '${a}'.
 Read more: https://nextjs.org/docs/messages/non-dynamic-getstaticpaths-usage`);if(k&&!ev)throw Error(`getStaticPaths was added without a getStaticProps in ${a}. Without getStaticProps, getStaticPaths does nothing`);if(ev&&eS&&!k)throw Error(`getStaticPaths is required for dynamic SSG pages and is missing for '${a}'.
 Read more: https://nextjs.org/docs/messages/invalid-getstaticpaths-value`);let eC=l.resolvedAsPath||n.url;if(w){let{isValidElementType:e}=r("./dist/compiled/react-is/index.js");if(!e(ed))throw Error(`The default export is not a React Component in page: "${a}"`);if(!e(ea))throw Error('The default export is not a React Component in page: "/_app"');if(!e(el))throw Error('The default export is not a React Component in page: "/_document"');if((e_||eu)&&(i={...i.amp?{amp:i.amp}:{}},eC=`${a}${n.url.endsWith("/")&&"/"!==a&&!eS?"/":""}`,n.url=a),"/404"===a&&(eb||M))throw Error(`\`pages/404\` ${C.Ei}`);if(R.Er.includes(a)&&(eb||M))throw Error(`\`pages${a}\` ${C.Ei}`)}for(let e of["getStaticProps","getServerSideProps","getStaticPaths"])if(null==ed?void 0:ed[e])throw Error(`page ${a} ${e} ${C.lk}`);await H.preloadAll(),(ev||M)&&!eu&&F&&(m=!1!==(h=e(n,s,F,!!l.multiZoneDraftMode)));let eR=new e0(a,i,eC,{isFallback:eu},!!(M||eb||!ex&&!ev||et),W,l.locale,l.locales,l.defaultLocale,l.domainLocales,m,ee(n,"isLocaleDomain")),ej={back(){eR.back()},forward(){eR.forward()},refresh(){eR.reload()},fastRefresh(){},push(e,t){let{scroll:r}=void 0===t?{}:t;eR.push(e,void 0,{scroll:r})},replace(e,t){let{scroll:r}=void 0===t?{}:t;eR.replace(e,void 0,{scroll:r})},prefetch(e){eR.prefetch(e)}},eT={},eE=(0,_.createStyleRegistry)(),e$={ampFirst:!0===j.amp,hasQuery:!!i.amp,hybrid:"hybrid"===j.amp},eN=function(e){let{ampFirst:t=!1,hybrid:r=!1,hasQuery:n=!1}=void 0===e?{}:e;return t||r&&n}(e$),eA=function(e){void 0===e&&(e=!1);let t=[(0,y.jsx)("meta",{charSet:"utf-8"})];return e||t.push((0,y.jsx)("meta",{name:"viewport",content:"width=device-width"})),t}(eN),eD=[],eF={};ew&&(eF.beforeInteractive=[].concat(ew()).filter(e=>"beforeInteractive"===e.props.strategy).map(e=>e.props));let eH=({children:e})=>(0,y.jsx)(eW.Provider,{value:ej,children:(0,y.jsx)(eM.Provider,{value:eR.isReady&&eR.query?new URL(eR.asPath,"http://n").searchParams:new URLSearchParams,children:(0,y.jsx)(eU,{router:eR,isAutoExport:e_,children:(0,y.jsx)(eq.Provider,{value:function(e){if(!e.isReady||!e.query)return null;let t={};for(let r of Object.keys(function(e){let{parameterizedRoute:t,groups:r}=function(e){let t=em(e).slice(1).split("/"),r={},n=1;return{parameterizedRoute:t.map(e=>{let t=U.find(t=>e.startsWith(t)),o=e.match(/\[((?:\[.*\])|.+)\]/);if(t&&o){let{key:e,optional:s,repeat:a}=ez(o[1]);return r[e]={pos:n++,repeat:a,optional:s},"/"+eB(t)+"([^/]+?)"}if(!o)return"/"+eB(e);{let{key:e,repeat:t,optional:s}=ez(o[1]);return r[e]={pos:n++,repeat:t,optional:s},t?s?"(?:/(.+?))?":"/(.+?)":"/([^/]+?)"}}).join(""),groups:r}}(e);return{re:RegExp("^"+t+"(?:/)?$"),groups:r}}(e.pathname).groups))t[r]=e.query[r];return t}(eR),children:(0,y.jsx)(B.Provider,{value:eR,children:(0,y.jsx)(L.Provider,{value:e$,children:(0,y.jsx)(O.Provider,{value:{updateHead:e=>{eA=e},updateScripts:e=>{eT=e},scripts:eF,mountedInstances:new Set},children:(0,y.jsx)(A.Provider,{value:e=>eD.push(e),children:(0,y.jsx)(_.StyleRegistry,{registry:eE,children:(0,y.jsx)(eO.Provider,{value:Q,children:e})})})})})})})})})}),eG=()=>null,eJ=({children:e})=>(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(eG,{}),(0,y.jsx)(eH,{children:(0,y.jsxs)(y.Fragment,{children:[w?(0,y.jsxs)(y.Fragment,{children:[e,(0,y.jsx)(eG,{})]}):e,(0,y.jsx)(eG,{})]})})]}),eV={err:b,req:e_?void 0:n,res:e_?void 0:s,pathname:a,query:i,asPath:eC,locale:l.locale,locales:l.locales,defaultLocale:l.defaultLocale,AppTree:e=>(0,y.jsx)(eJ,{children:e1(ea,ed,{...e,router:eR})}),defaultGetInitialProps:async(e,t={})=>{let{html:r,head:n}=await e.renderPage({enhanceApp:e=>t=>(0,y.jsx)(e,{...t})}),o=eE.styles({nonce:t.nonce});return eE.flush(),{html:r,head:n,styles:o}}},eX=!ev&&(l.nextExport||w&&(e_||eu)),eQ=()=>{let e=eE.styles();return eE.flush(),(0,y.jsx)(y.Fragment,{children:e})};if(f=await X(ea,{AppTree:eV.AppTree,Component:ed,router:eR,ctx:eV}),(ev||M)&&m&&(f.__N_PREVIEW=!0),ev&&(f[R.NO]=!0),ev&&!eu){let e,t;try{e=await (0,en.getTracer)().trace(eo.xj.getStaticProps,{spanName:`getStaticProps ${a}`,attributes:{"next.route":a}},()=>I({...eS?{params:i}:void 0,...m?{draftMode:!0,preview:!0,previewData:h}:void 0,locales:l.locales,locale:l.locale,defaultLocale:l.defaultLocale,revalidateReason:l.isOnDemandRevalidate?"on-demand":ey?"build":"stale"}))}catch(e){throw e&&"ENOENT"===e.code&&delete e.code,e}if(null==e)throw Error(C.q6);let r=Object.keys(e).filter(e=>"revalidate"!==e&&"props"!==e&&"redirect"!==e&&"notFound"!==e);if(r.includes("unstable_revalidate"))throw Error(C.Eo);if(r.length)throw Error(e4("getStaticProps",r));if("notFound"in e&&e.notFound){if("/404"===a)throw Error('The /404 page can not return notFound in "getStaticProps", please remove it to continue!');v.isNotFound=!0}if("redirect"in e&&e.redirect&&"object"==typeof e.redirect){if(e2(e.redirect,n,"getStaticProps"),ey)throw Error(`\`redirect\` can not be returned from getStaticProps during prerendering (${n.url})
Diff for pages.runtime.dev.js
@@ -11,7 +11,7 @@ Reason: ${n}`)}}function $(e,t,r){if(!T(r))throw new N(e,t,"",`Props must be ret
 
 Keys that need to be moved: ${t.join(", ")}.
 Read more: https://nextjs.org/docs/messages/${r}`};function e3(e,t,r){let{destination:n,permanent:o,statusCode:s,basePath:a}=e,i=[],l=void 0!==s,d=void 0!==o;d&&l?i.push("`permanent` and `statusCode` can not both be provided"):d&&"boolean"!=typeof o?i.push("`permanent` must be `true` or `false`"):l&&!et.has(s)&&i.push(`\`statusCode\` must undefined or one of ${[...et].join(", ")}`);let u=typeof n;"string"!==u&&i.push(`\`destination\` should be string but received ${u}`);let c=typeof a;if("undefined"!==c&&"boolean"!==c&&i.push(`\`basePath\` should be undefined or a false, received ${c}`),i.length>0)throw Error(`Invalid redirect object returned from ${r} for ${t.url}
-`+i.join(" and ")+"\nSee more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp")}async function e8(n,s,a,i,l,d){var u,c,p;let h,m,f,g;(0,x.gk)({req:n},"cookies",(c=n.headers,function(){let{cookie:e}=c;if(!e)return{};let{parse:t}=r("./dist/compiled/cookie/index.js");return t(Array.isArray(e)?e.join("; "):e)}));let v={};if(v.assetQueryString=l.dev&&l.assetQueryString||"",l.dev&&!v.assetQueryString){let e=(n.headers["user-agent"]||"").toLowerCase();e.includes("safari")&&!e.includes("chrome")&&(v.assetQueryString=`?ts=${Date.now()}`)}l.deploymentId&&(v.assetQueryString+=`${v.assetQueryString?"&":"?"}dpl=${l.deploymentId}`),i=Object.assign({},i);let{err:b,dev:w=!1,ampPath:S="",pageConfig:R={},buildManifest:T,reactLoadableManifest:E,ErrorDebug:N,getStaticProps:I,getStaticPaths:k,getServerSideProps:M,isDataReq:D,params:q,previewProps:F,basePath:W,images:Q,runtime:K,isExperimentalCompile:et,swrDelta:es}=l,{App:ea}=d,ei=v.assetQueryString,el=d.Document,ed=l.Component,eu=!!i.__nextFallback,eg=i.__nextNotFoundSrcPage;!function(e){for(let t of ek)delete e[t]}(i);let ev=!!I,ey=ev&&l.nextExport,ex=ea.getInitialProps===ea.origGetInitialProps,eb=!!(null==ed?void 0:ed.getInitialProps),ew=null==ed?void 0:ed.unstable_scriptLoader,eS=G(a),eP="/_error"===a&&ed.getInitialProps===ed.origGetInitialProps;l.nextExport&&eb&&!eP&&t(`Detected getInitialProps on page '${a}' while running export. It's recommended to use getStaticProps which has a more correct behavior for static exporting.
+`+i.join(" and ")+"\nSee more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp")}async function e8(n,s,a,i,l,d){var u,c,p;let h,m,f,g;(0,x.gk)({req:n},"cookies",(c=n.headers,function(){let{cookie:e}=c;if(!e)return{};let{parse:t}=r("./dist/compiled/cookie/index.js");return t(Array.isArray(e)?e.join("; "):e)}));let v={};if(v.assetQueryString=l.dev&&l.assetQueryString||"",l.dev&&!v.assetQueryString){let e=(n.headers["user-agent"]||"").toLowerCase();e.includes("safari")&&!e.includes("chrome")&&(v.assetQueryString=`?ts=${Date.now()}`)}l.deploymentId&&(v.assetQueryString+=`${v.assetQueryString?"&":"?"}dpl=${l.deploymentId}`),i=Object.assign({},i);let{err:b,dev:w=!1,ampPath:S="",pageConfig:R={},buildManifest:T,reactLoadableManifest:E,ErrorDebug:N,getStaticProps:I,getStaticPaths:k,getServerSideProps:M,isNextDataRequest:D,params:q,previewProps:F,basePath:W,images:Q,runtime:K,isExperimentalCompile:et,swrDelta:es}=l,{App:ea}=d,ei=v.assetQueryString,el=d.Document,ed=l.Component,eu=!!i.__nextFallback,eg=i.__nextNotFoundSrcPage;!function(e){for(let t of ek)delete e[t]}(i);let ev=!!I,ey=ev&&l.nextExport,ex=ea.getInitialProps===ea.origGetInitialProps,eb=!!(null==ed?void 0:ed.getInitialProps),ew=null==ed?void 0:ed.unstable_scriptLoader,eS=G(a),eP="/_error"===a&&ed.getInitialProps===ed.origGetInitialProps;l.nextExport&&eb&&!eP&&t(`Detected getInitialProps on page '${a}' while running export. It's recommended to use getStaticProps which has a more correct behavior for static exporting.
 Read more: https://nextjs.org/docs/messages/get-initial-props-export`);let e_=!eb&&ex&&!ev&&!M;if(e_&&!w&&et&&(s.setHeader("Cache-Control",function({revalidate:e,swrDelta:t}){let r=t?`stale-while-revalidate=${t}`:"stale-while-revalidate";return 0===e?"private, no-cache, no-store, max-age=0, must-revalidate":"number"==typeof e?`s-maxage=${e}, ${r}`:`s-maxage=${C.BR}, ${r}`}({revalidate:!1,swrDelta:es})),e_=!1),eb&&ev)throw Error(C.wh+` ${a}`);if(eb&&M)throw Error(C.Wo+` ${a}`);if(M&&ev)throw Error(C.oL+` ${a}`);if(M&&"export"===l.nextConfigOutput)throw Error('getServerSideProps cannot be used with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export');if(k&&!eS)throw Error(`getStaticPaths is only allowed for dynamic SSG pages and was found on '${a}'.
 Read more: https://nextjs.org/docs/messages/non-dynamic-getstaticpaths-usage`);if(k&&!ev)throw Error(`getStaticPaths was added without a getStaticProps in ${a}. Without getStaticProps, getStaticPaths does nothing`);if(ev&&eS&&!k)throw Error(`getStaticPaths is required for dynamic SSG pages and is missing for '${a}'.
 Read more: https://nextjs.org/docs/messages/invalid-getstaticpaths-value`);let eC=l.resolvedAsPath||n.url;if(w){let{isValidElementType:e}=r("./dist/compiled/react-is/index.js");if(!e(ed))throw Error(`The default export is not a React Component in page: "${a}"`);if(!e(ea))throw Error('The default export is not a React Component in page: "/_app"');if(!e(el))throw Error('The default export is not a React Component in page: "/_document"');if((e_||eu)&&(i={...i.amp?{amp:i.amp}:{}},eC=`${a}${n.url.endsWith("/")&&"/"!==a&&!eS?"/":""}`,n.url=a),"/404"===a&&(eb||M))throw Error(`\`pages/404\` ${C.Ei}`);if(j.Er.includes(a)&&(eb||M))throw Error(`\`pages${a}\` ${C.Ei}`)}for(let e of["getStaticProps","getServerSideProps","getStaticPaths"])if(null==ed?void 0:ed[e])throw Error(`page ${a} ${e} ${C.lk}`);await H.preloadAll(),(ev||M)&&!eu&&F&&(f=!1!==(h=e(n,s,F,!!l.multiZoneDraftMode)));let ej=new e1(a,i,eC,{isFallback:eu},!!(M||eb||!ex&&!ev||et),W,l.locale,l.locales,l.defaultLocale,l.domainLocales,f,ee(n,"isLocaleDomain")),eR={back(){ej.back()},forward(){ej.forward()},refresh(){ej.reload()},fastRefresh(){},push(e,t){let{scroll:r}=void 0===t?{}:t;ej.push(e,void 0,{scroll:r})},replace(e,t){let{scroll:r}=void 0===t?{}:t;ej.replace(e,void 0,{scroll:r})},prefetch(e){ej.prefetch(e)}},eT={},eE=(0,_.createStyleRegistry)(),eN={ampFirst:!0===R.amp,hasQuery:!!i.amp,hybrid:"hybrid"===R.amp},e$=function(e){let{ampFirst:t=!1,hybrid:r=!1,hasQuery:n=!1}=void 0===e?{}:e;return t||r&&n}(eN),eA=function(e){void 0===e&&(e=!1);let t=[(0,y.jsx)("meta",{charSet:"utf-8"})];return e||t.push((0,y.jsx)("meta",{name:"viewport",content:"width=device-width"})),t}(e$),eD=[],eF={};ew&&(eF.beforeInteractive=[].concat(ew()).filter(e=>"beforeInteractive"===e.props.strategy).map(e=>e.props));let eH=({children:e})=>(0,y.jsx)(eW.Provider,{value:eR,children:(0,y.jsx)(eM.Provider,{value:ej.isReady&&ej.query?new URL(ej.asPath,"http://n").searchParams:new URLSearchParams,children:(0,y.jsx)(eU,{router:ej,isAutoExport:e_,children:(0,y.jsx)(eq.Provider,{value:function(e){if(!e.isReady||!e.query)return null;let t={};for(let r of Object.keys(function(e){let{parameterizedRoute:t,groups:r}=function(e){let t=ef(e).slice(1).split("/"),r={},n=1;return{parameterizedRoute:t.map(e=>{let t=U.find(t=>e.startsWith(t)),o=e.match(/\[((?:\[.*\])|.+)\]/);if(t&&o){let{key:e,optional:s,repeat:a}=eB(o[1]);return r[e]={pos:n++,repeat:a,optional:s},"/"+ez(t)+"([^/]+?)"}if(!o)return"/"+ez(e);{let{key:e,repeat:t,optional:s}=eB(o[1]);return r[e]={pos:n++,repeat:t,optional:s},t?s?"(?:/(.+?))?":"/(.+?)":"/([^/]+?)"}}).join(""),groups:r}}(e);return{re:RegExp("^"+t+"(?:/)?$"),groups:r}}(e.pathname).groups))t[r]=e.query[r];return t}(ej),children:(0,y.jsx)(z.Provider,{value:ej,children:(0,y.jsx)(L.Provider,{value:eN,children:(0,y.jsx)(O.Provider,{value:{updateHead:e=>{eA=e},updateScripts:e=>{eT=e},scripts:eF,mountedInstances:new Set},children:(0,y.jsx)(A.Provider,{value:e=>eD.push(e),children:(0,y.jsx)(_.StyleRegistry,{registry:eE,children:(0,y.jsx)(eO.Provider,{value:Q,children:e})})})})})})})})})}),eG=()=>null,eJ=({children:e})=>(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(eG,{}),(0,y.jsx)(eH,{children:(0,y.jsxs)(y.Fragment,{children:[w?(0,y.jsxs)(y.Fragment,{children:[e,(0,y.jsx)(eG,{})]}):e,(0,y.jsx)(eG,{})]})})]}),eY={err:b,req:e_?void 0:n,res:e_?void 0:s,pathname:a,query:i,asPath:eC,locale:l.locale,locales:l.locales,defaultLocale:l.defaultLocale,AppTree:e=>(0,y.jsx)(eJ,{children:e4(ea,ed,{...e,router:ej})}),defaultGetInitialProps:async(e,t={})=>{let{html:r,head:n}=await e.renderPage({enhanceApp:e=>t=>(0,y.jsx)(e,{...t})}),o=eE.styles({nonce:t.nonce});return eE.flush(),{html:r,head:n,styles:o}}},eV=!ev&&(l.nextExport||w&&(e_||eu)),eK=()=>{let e=eE.styles();return eE.flush(),(0,y.jsx)(y.Fragment,{children:e})};if(m=await V(ea,{AppTree:eY.AppTree,Component:ed,router:ej,ctx:eY}),(ev||M)&&f&&(m.__N_PREVIEW=!0),ev&&(m[j.NO]=!0),ev&&!eu){let e,t;try{e=await (0,en.getTracer)().trace(eo.xj.getStaticProps,{spanName:`getStaticProps ${a}`,attributes:{"next.route":a}},()=>I({...eS?{params:i}:void 0,...f?{draftMode:!0,preview:!0,previewData:h}:void 0,locales:l.locales,locale:l.locale,defaultLocale:l.defaultLocale,revalidateReason:l.isOnDemandRevalidate?"on-demand":ey?"build":"stale"}))}catch(e){throw e&&"ENOENT"===e.code&&delete e.code,e}if(null==e)throw Error(C.q6);let r=Object.keys(e).filter(e=>"revalidate"!==e&&"props"!==e&&"redirect"!==e&&"notFound"!==e);if(r.includes("unstable_revalidate"))throw Error(C.Eo);if(r.length)throw Error(e2("getStaticProps",r));if(void 0!==e.notFound&&void 0!==e.redirect)throw Error(`\`redirect\` and \`notFound\` can not both be returned from ${ev?"getStaticProps":"getServerSideProps"} at the same time. Page: ${a}
Diff for pages.runtime.prod.js
@@ -19,7 +19,7 @@ Reason: ${n}`)}}function N(e,t,r){if(!T(r))throw new $(e,t,"",`Props must be ret
 
 Keys that need to be moved: ${t.join(", ")}.
 Read more: https://nextjs.org/docs/messages/${r}`};function e2(e,t,r){let{destination:n,permanent:o,statusCode:s,basePath:a}=e,i=[],l=void 0!==s,d=void 0!==o;d&&l?i.push("`permanent` and `statusCode` can not both be provided"):d&&"boolean"!=typeof o?i.push("`permanent` must be `true` or `false`"):l&&!et.has(s)&&i.push(`\`statusCode\` must undefined or one of ${[...et].join(", ")}`);let u=typeof n;"string"!==u&&i.push(`\`destination\` should be string but received ${u}`);let c=typeof a;if("undefined"!==c&&"boolean"!==c&&i.push(`\`basePath\` should be undefined or a false, received ${c}`),i.length>0)throw Error(`Invalid redirect object returned from ${r} for ${t.url}
-`+i.join(" and ")+"\nSee more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp")}async function e3(n,s,a,i,l,d){var u,c,p;let h,f,m,g;(0,x.gk)({req:n},"cookies",(c=n.headers,function(){let{cookie:e}=c;if(!e)return{};let{parse:t}=r("./dist/compiled/cookie/index.js");return t(Array.isArray(e)?e.join("; "):e)}));let v={};if(v.assetQueryString=l.dev&&l.assetQueryString||"",l.dev&&!v.assetQueryString){let e=(n.headers["user-agent"]||"").toLowerCase();e.includes("safari")&&!e.includes("chrome")&&(v.assetQueryString=`?ts=${Date.now()}`)}l.deploymentId&&(v.assetQueryString+=`${v.assetQueryString?"&":"?"}dpl=${l.deploymentId}`),i=Object.assign({},i);let{err:b,dev:w=!1,ampPath:S="",pageConfig:j={},buildManifest:T,reactLoadableManifest:E,ErrorDebug:$,getStaticProps:I,getStaticPaths:k,getServerSideProps:M,isDataReq:D,params:q,previewProps:F,basePath:W,images:Q,runtime:K,isExperimentalCompile:et,swrDelta:es}=l,{App:ea}=d,ei=v.assetQueryString,el=d.Document,ed=l.Component,eu=!!i.__nextFallback,eg=i.__nextNotFoundSrcPage;!function(e){for(let t of ek)delete e[t]}(i);let ev=!!I,ey=ev&&l.nextExport,ex=ea.getInitialProps===ea.origGetInitialProps,eb=!!(null==ed?void 0:ed.getInitialProps),ew=null==ed?void 0:ed.unstable_scriptLoader,eS=G(a),eP="/_error"===a&&ed.getInitialProps===ed.origGetInitialProps;l.nextExport&&eb&&!eP&&t(`Detected getInitialProps on page '${a}' while running export. It's recommended to use getStaticProps which has a more correct behavior for static exporting.
+`+i.join(" and ")+"\nSee more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp")}async function e3(n,s,a,i,l,d){var u,c,p;let h,f,m,g;(0,x.gk)({req:n},"cookies",(c=n.headers,function(){let{cookie:e}=c;if(!e)return{};let{parse:t}=r("./dist/compiled/cookie/index.js");return t(Array.isArray(e)?e.join("; "):e)}));let v={};if(v.assetQueryString=l.dev&&l.assetQueryString||"",l.dev&&!v.assetQueryString){let e=(n.headers["user-agent"]||"").toLowerCase();e.includes("safari")&&!e.includes("chrome")&&(v.assetQueryString=`?ts=${Date.now()}`)}l.deploymentId&&(v.assetQueryString+=`${v.assetQueryString?"&":"?"}dpl=${l.deploymentId}`),i=Object.assign({},i);let{err:b,dev:w=!1,ampPath:S="",pageConfig:j={},buildManifest:T,reactLoadableManifest:E,ErrorDebug:$,getStaticProps:I,getStaticPaths:k,getServerSideProps:M,isNextDataRequest:D,params:q,previewProps:F,basePath:W,images:Q,runtime:K,isExperimentalCompile:et,swrDelta:es}=l,{App:ea}=d,ei=v.assetQueryString,el=d.Document,ed=l.Component,eu=!!i.__nextFallback,eg=i.__nextNotFoundSrcPage;!function(e){for(let t of ek)delete e[t]}(i);let ev=!!I,ey=ev&&l.nextExport,ex=ea.getInitialProps===ea.origGetInitialProps,eb=!!(null==ed?void 0:ed.getInitialProps),ew=null==ed?void 0:ed.unstable_scriptLoader,eS=G(a),eP="/_error"===a&&ed.getInitialProps===ed.origGetInitialProps;l.nextExport&&eb&&!eP&&t(`Detected getInitialProps on page '${a}' while running export. It's recommended to use getStaticProps which has a more correct behavior for static exporting.
 Read more: https://nextjs.org/docs/messages/get-initial-props-export`);let e_=!eb&&ex&&!ev&&!M;if(e_&&!w&&et&&(s.setHeader("Cache-Control",function({revalidate:e,swrDelta:t}){let r=t?`stale-while-revalidate=${t}`:"stale-while-revalidate";return 0===e?"private, no-cache, no-store, max-age=0, must-revalidate":"number"==typeof e?`s-maxage=${e}, ${r}`:`s-maxage=${C.BR}, ${r}`}({revalidate:!1,swrDelta:es})),e_=!1),eb&&ev)throw Error(C.wh+` ${a}`);if(eb&&M)throw Error(C.Wo+` ${a}`);if(M&&ev)throw Error(C.oL+` ${a}`);if(M&&"export"===l.nextConfigOutput)throw Error('getServerSideProps cannot be used with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export');if(k&&!eS)throw Error(`getStaticPaths is only allowed for dynamic SSG pages and was found on '${a}'.
 Read more: https://nextjs.org/docs/messages/non-dynamic-getstaticpaths-usage`);if(k&&!ev)throw Error(`getStaticPaths was added without a getStaticProps in ${a}. Without getStaticProps, getStaticPaths does nothing`);if(ev&&eS&&!k)throw Error(`getStaticPaths is required for dynamic SSG pages and is missing for '${a}'.
 Read more: https://nextjs.org/docs/messages/invalid-getstaticpaths-value`);let eC=l.resolvedAsPath||n.url;if(w){let{isValidElementType:e}=r("./dist/compiled/react-is/index.js");if(!e(ed))throw Error(`The default export is not a React Component in page: "${a}"`);if(!e(ea))throw Error('The default export is not a React Component in page: "/_app"');if(!e(el))throw Error('The default export is not a React Component in page: "/_document"');if((e_||eu)&&(i={...i.amp?{amp:i.amp}:{}},eC=`${a}${n.url.endsWith("/")&&"/"!==a&&!eS?"/":""}`,n.url=a),"/404"===a&&(eb||M))throw Error(`\`pages/404\` ${C.Ei}`);if(R.Er.includes(a)&&(eb||M))throw Error(`\`pages${a}\` ${C.Ei}`)}for(let e of["getStaticProps","getServerSideProps","getStaticPaths"])if(null==ed?void 0:ed[e])throw Error(`page ${a} ${e} ${C.lk}`);await H.preloadAll(),(ev||M)&&!eu&&F&&(m=!1!==(h=e(n,s,F,!!l.multiZoneDraftMode)));let eR=new e0(a,i,eC,{isFallback:eu},!!(M||eb||!ex&&!ev||et),W,l.locale,l.locales,l.defaultLocale,l.domainLocales,m,ee(n,"isLocaleDomain")),ej={back(){eR.back()},forward(){eR.forward()},refresh(){eR.reload()},fastRefresh(){},push(e,t){let{scroll:r}=void 0===t?{}:t;eR.push(e,void 0,{scroll:r})},replace(e,t){let{scroll:r}=void 0===t?{}:t;eR.replace(e,void 0,{scroll:r})},prefetch(e){eR.prefetch(e)}},eT={},eE=(0,_.createStyleRegistry)(),e$={ampFirst:!0===j.amp,hasQuery:!!i.amp,hybrid:"hybrid"===j.amp},eN=function(e){let{ampFirst:t=!1,hybrid:r=!1,hasQuery:n=!1}=void 0===e?{}:e;return t||r&&n}(e$),eA=function(e){void 0===e&&(e=!1);let t=[(0,y.jsx)("meta",{charSet:"utf-8"})];return e||t.push((0,y.jsx)("meta",{name:"viewport",content:"width=device-width"})),t}(eN),eD=[],eF={};ew&&(eF.beforeInteractive=[].concat(ew()).filter(e=>"beforeInteractive"===e.props.strategy).map(e=>e.props));let eH=({children:e})=>(0,y.jsx)(eW.Provider,{value:ej,children:(0,y.jsx)(eM.Provider,{value:eR.isReady&&eR.query?new URL(eR.asPath,"http://n").searchParams:new URLSearchParams,children:(0,y.jsx)(eU,{router:eR,isAutoExport:e_,children:(0,y.jsx)(eq.Provider,{value:function(e){if(!e.isReady||!e.query)return null;let t={};for(let r of Object.keys(function(e){let{parameterizedRoute:t,groups:r}=function(e){let t=em(e).slice(1).split("/"),r={},n=1;return{parameterizedRoute:t.map(e=>{let t=U.find(t=>e.startsWith(t)),o=e.match(/\[((?:\[.*\])|.+)\]/);if(t&&o){let{key:e,optional:s,repeat:a}=ez(o[1]);return r[e]={pos:n++,repeat:a,optional:s},"/"+eB(t)+"([^/]+?)"}if(!o)return"/"+eB(e);{let{key:e,repeat:t,optional:s}=ez(o[1]);return r[e]={pos:n++,repeat:t,optional:s},t?s?"(?:/(.+?))?":"/(.+?)":"/([^/]+?)"}}).join(""),groups:r}}(e);return{re:RegExp("^"+t+"(?:/)?$"),groups:r}}(e.pathname).groups))t[r]=e.query[r];return t}(eR),children:(0,y.jsx)(B.Provider,{value:eR,children:(0,y.jsx)(L.Provider,{value:e$,children:(0,y.jsx)(O.Provider,{value:{updateHead:e=>{eA=e},updateScripts:e=>{eT=e},scripts:eF,mountedInstances:new Set},children:(0,y.jsx)(A.Provider,{value:e=>eD.push(e),children:(0,y.jsx)(_.StyleRegistry,{registry:eE,children:(0,y.jsx)(eO.Provider,{value:Q,children:e})})})})})})})})})}),eG=()=>null,eJ=({children:e})=>(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(eG,{}),(0,y.jsx)(eH,{children:(0,y.jsxs)(y.Fragment,{children:[w?(0,y.jsxs)(y.Fragment,{children:[e,(0,y.jsx)(eG,{})]}):e,(0,y.jsx)(eG,{})]})})]}),eV={err:b,req:e_?void 0:n,res:e_?void 0:s,pathname:a,query:i,asPath:eC,locale:l.locale,locales:l.locales,defaultLocale:l.defaultLocale,AppTree:e=>(0,y.jsx)(eJ,{children:e1(ea,ed,{...e,router:eR})}),defaultGetInitialProps:async(e,t={})=>{let{html:r,head:n}=await e.renderPage({enhanceApp:e=>t=>(0,y.jsx)(e,{...t})}),o=eE.styles({nonce:t.nonce});return eE.flush(),{html:r,head:n,styles:o}}},eX=!ev&&(l.nextExport||w&&(e_||eu)),eQ=()=>{let e=eE.styles();return eE.flush(),(0,y.jsx)(y.Fragment,{children:e})};if(f=await X(ea,{AppTree:eV.AppTree,Component:ed,router:eR,ctx:eV}),(ev||M)&&m&&(f.__N_PREVIEW=!0),ev&&(f[R.NO]=!0),ev&&!eu){let e,t;try{e=await (0,en.getTracer)().trace(eo.xj.getStaticProps,{spanName:`getStaticProps ${a}`,attributes:{"next.route":a}},()=>I({...eS?{params:i}:void 0,...m?{draftMode:!0,preview:!0,previewData:h}:void 0,locales:l.locales,locale:l.locale,defaultLocale:l.defaultLocale,revalidateReason:l.isOnDemandRevalidate?"on-demand":ey?"build":"stale"}))}catch(e){throw e&&"ENOENT"===e.code&&delete e.code,e}if(null==e)throw Error(C.q6);let r=Object.keys(e).filter(e=>"revalidate"!==e&&"props"!==e&&"redirect"!==e&&"notFound"!==e);if(r.includes("unstable_revalidate"))throw Error(C.Eo);if(r.length)throw Error(e4("getStaticProps",r));if("notFound"in e&&e.notFound){if("/404"===a)throw Error('The /404 page can not return notFound in "getStaticProps", please remove it to continue!');v.isNotFound=!0}if("redirect"in e&&e.redirect&&"object"==typeof e.redirect){if(e2(e.redirect,n,"getStaticProps"),ey)throw Error(`\`redirect\` can not be returned from getStaticProps during prerendering (${n.url})
Diff for server.runtime.prod.js

Diff too large to display

Commit: 66a9eaa

@ijjk ijjk marked this pull request as ready for review September 13, 2024 18:02
@ijjk ijjk merged commit 0b907c7 into 14-2-1 Sep 13, 2024
53 of 58 checks passed
@ijjk ijjk deleted the backport/b5d911c92c7471efe056c96832fa4b0216d19dad branch September 13, 2024 18:23
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants