File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
packages/react-dom/src/__tests__ Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1417,6 +1417,32 @@ describe('ReactUpdates', () => {
1417
1417
expect ( container . textContent ) . toBe ( '1' ) ;
1418
1418
} ) ;
1419
1419
1420
+ it ( 'does not fall into mutually recursive infinite update loop' , ( ) => {
1421
+ class A extends React . Component {
1422
+ state = { step : 0 } ;
1423
+ componentDidMount ( ) {
1424
+ ReactDOM . render ( < B /> , container ) ;
1425
+ }
1426
+ render ( ) {
1427
+ return null ;
1428
+ }
1429
+ }
1430
+
1431
+ class B extends React . Component {
1432
+ componentDidMount ( ) {
1433
+ ReactDOM . render ( < A /> , container ) ;
1434
+ }
1435
+ render ( ) {
1436
+ return null ;
1437
+ }
1438
+ }
1439
+
1440
+ const container = document . createElement ( 'div' ) ;
1441
+ expect ( ( ) => {
1442
+ ReactDOM . render ( < A /> , container ) ;
1443
+ } ) . toThrow ( 'Maximum' ) ;
1444
+ } ) ;
1445
+
1420
1446
it ( 'does not fall into an infinite error loop' , ( ) => {
1421
1447
function BadRender ( ) {
1422
1448
throw new Error ( 'error' ) ;
You can’t perform that action at this time.
0 commit comments