File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
packages/react-server/src Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -765,12 +765,27 @@ type ThrownInfo = {
765
765
export type ErrorInfo = ThrownInfo ;
766
766
export type PostponeInfo = ThrownInfo ;
767
767
768
+ type ThrownInfo = {
769
+ componentStack ?: string ,
770
+ } ;
771
+ export type ErrorInfo = ThrownInfo ;
772
+ export type PostponeInfo = ThrownInfo ;
773
+
768
774
// While we track component stacks in prod all the time we only produce a reified stack in dev and
769
775
// during prerender in Prod. The reason for this is that the stack is useful for prerender where the timeliness
770
776
// of the request is less critical than the observability of the execution. For renders and resumes however we
771
777
// prioritize speed of the request.
772
- function getThrownInfo ( node : null | ComponentStackNode ) : ThrownInfo {
773
- if ( node ) {
778
+ function getThrownInfo (
779
+ request : Request ,
780
+ node : null | ComponentStackNode ,
781
+ ) : ThrownInfo {
782
+ if (
783
+ node &&
784
+ // Always produce a stack in dev
785
+ ( __DEV__ ||
786
+ // Produce a stack in prod if we're in a prerender
787
+ request . trackedPostpones !== null )
788
+ ) {
774
789
return {
775
790
componentStack : getStackFromNode ( node ) ,
776
791
} ;
You can’t perform that action at this time.
0 commit comments