You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to this change mutliple sync dynamic APIs could trigger multiple aborts. Generally this isn't a problem however it is wasteful compute and blocks a later refactor where we stop explicitly tracking whether the sync dynamic access is what caused the prerender to abort or not. To achieve better perf and future semantics we now only abort if the prerender is not yet aborted. In effect this means that there can only be one sync abort error per prerender in RSC and SSR respectively.
message=`Route "${workStore.route}" used ${expression} instead of using \`performance\` or without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time`
21
-
break
22
-
case'random':
23
-
message=`Route "${workStore.route}" used ${expression} outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random`
24
-
break
25
-
case'crypto':
26
-
message=`Route "${workStore.route}" used ${expression} outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-crypto`
27
-
break
28
-
default:
29
-
thrownewInvariantError(
30
-
'Unknown expression type in abortOnSynchronousPlatformIOAccess.'
// If the prerender signal is already aborted we don't need to construct any stacks
18
+
// becuase something else actually terminated the prerender.
19
+
constworkStore=workAsyncStorage.getStore()
20
+
if(workStore){
21
+
letmessage: string
22
+
switch(type){
23
+
case'time':
24
+
message=`Route "${workStore.route}" used ${expression} instead of using \`performance\` or without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time`
25
+
break
26
+
case'random':
27
+
message=`Route "${workStore.route}" used ${expression} outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random`
28
+
break
29
+
case'crypto':
30
+
message=`Route "${workStore.route}" used ${expression} outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-crypto`
31
+
break
32
+
default:
33
+
thrownewInvariantError(
34
+
'Unknown expression type in abortOnSynchronousPlatformIOAccess.'
0 commit comments