File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
packages/react-dom/src/__tests__ Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -567,6 +567,14 @@ describe('creating element with string ref in constructor', () => {
567
567
} ) ;
568
568
569
569
describe ( 'strings refs across renderers' , ( ) => {
570
+ beforeEach ( ( ) => {
571
+ React = require ( 'react' ) ;
572
+ ReactDOMClient = require ( 'react-dom/client' ) ;
573
+ ReactFeatureFlags = require ( 'shared/ReactFeatureFlags' ) ;
574
+ ReactTestUtils = require ( 'react-dom/test-utils' ) ;
575
+ act = require ( 'internal-test-utils' ) . act ;
576
+ } ) ;
577
+
570
578
it ( 'does not break' , async ( ) => {
571
579
class Parent extends React . Component {
572
580
render ( ) {
@@ -582,10 +590,13 @@ describe('strings refs across renderers', () => {
582
590
583
591
class Indirection extends React . Component {
584
592
componentDidUpdate ( ) {
593
+ jest . resetModules ( ) ;
585
594
// One ref is being rendered later using another renderer copy.
586
595
const AnotherCopyOfReactDOM = require ( 'react-dom' ) ;
587
596
const AnotherCopyOfReactDOMClient = require ( 'react-dom/client' ) ;
588
597
const root = AnotherCopyOfReactDOMClient . createRoot ( div2 ) ;
598
+
599
+ // TODO: this should error since flushSync is called in a lifecycle.
589
600
AnotherCopyOfReactDOM . flushSync ( ( ) => {
590
601
root . render ( this . props . child2 ) ;
591
602
} ) ;
You can’t perform that action at this time.
0 commit comments