@@ -184,12 +184,14 @@ export function commitHookEffectListMount(
184
184
} else {
185
185
addendum = ' You returned: ' + destroy ;
186
186
}
187
- console . error (
188
- '%s must not return anything besides a function, ' +
189
- 'which is used for clean-up.%s' ,
190
- hookName ,
191
- addendum ,
192
- ) ;
187
+ runWithFiberInDEV ( finishedWork , ( ) => {
188
+ console . error (
189
+ '%s must not return anything besides a function, ' +
190
+ 'which is used for clean-up.%s' ,
191
+ hookName ,
192
+ addendum ,
193
+ ) ;
194
+ } ) ;
193
195
}
194
196
}
195
197
}
@@ -642,11 +644,13 @@ export function commitClassSnapshot(finishedWork: Fiber, current: Fiber) {
642
644
( ( didWarnAboutUndefinedSnapshotBeforeUpdate : any ) : Set < mixed > ) ;
643
645
if ( snapshot === undefined && ! didWarnSet . has ( finishedWork . type ) ) {
644
646
didWarnSet . add ( finishedWork . type ) ;
645
- console . error (
646
- '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' +
647
- 'must be returned. You have returned undefined.' ,
648
- getComponentNameFromFiber ( finishedWork ) ,
649
- ) ;
647
+ runWithFiberInDEV ( finishedWork , ( ) => {
648
+ console . error (
649
+ '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' +
650
+ 'must be returned. You have returned undefined.' ,
651
+ getComponentNameFromFiber ( finishedWork ) ,
652
+ ) ;
653
+ } ) ;
650
654
}
651
655
} else {
652
656
snapshot = callGetSnapshotBeforeUpdates (
0 commit comments