File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 5555 "jest-dom" : " 3.1.3" ,
5656 "jest-in-case" : " ^1.0.2" ,
5757 "kcd-scripts" : " 1.1.2" ,
58- "react" : " 16.9.0-alpha.0 " ,
59- "react-dom" : " 16.9.0-alpha.0 " ,
58+ "react" : " ^ 16.8.6 " ,
59+ "react-dom" : " ^ 16.8.6 " ,
6060 "react-intl" : " ^2.8.0" ,
6161 "react-redux" : " 6.0.1" ,
6262 "react-router" : " ^5.0.0" ,
Original file line number Diff line number Diff line change 11import { asyncAct } from '../act-compat'
22
3+ jest . mock ( '../react-dom-16.9.0-is-released' , ( ) => ( {
4+ reactDomSixteenPointNineIsReleased : true ,
5+ } ) )
6+
37jest . mock ( 'react-dom/test-utils' , ( ) => ( {
48 act : cb => {
59 const promise = cb ( )
Original file line number Diff line number Diff line change 11import React from 'react'
22import ReactDOM from 'react-dom'
3+ import { reactDomSixteenPointNineIsReleased } from './react-dom-16.9.0-is-released'
34
45let reactAct
56let actSupported = false
1415 errorCalled = true
1516 }
1617 console . error . calls = [ ]
17- reactAct ( ( ) => ( { then : ( ) => { } } ) ) . then ( /* istanbul ignore next */ ( ) => { } )
18+ /* istanbul ignore next */
19+ reactAct ( ( ) => ( { then : ( ) => { } } ) ) . then ( ( ) => { } )
20+ /* istanbul ignore next */
1821 if ( ! errorCalled ) {
1922 asyncActSupported = true
2023 }
@@ -39,7 +42,12 @@ let youHaveBeenWarned = false
3942// state updates asynchronously, but at least we can tell people they need
4043// to upgrade to avoid the warnings.
4144async function asyncActPolyfill ( cb ) {
42- if ( ! youHaveBeenWarned && actSupported ) {
45+ // istanbul-ignore-next
46+ if (
47+ ! youHaveBeenWarned &&
48+ actSupported &&
49+ reactDomSixteenPointNineIsReleased
50+ ) {
4351 // if act is supported and async act isn't and they're trying to use async
4452 // act, then they need to upgrade from 16.8 to 16.9.
4553 // This is a seemless upgrade, so we'll add a warning
@@ -53,6 +61,7 @@ async function asyncActPolyfill(cb) {
5361 act ( ( ) => { } )
5462}
5563
64+ // istanbul ignore next
5665const asyncAct = asyncActSupported ? reactAct : asyncActPolyfill
5766
5867export default act
Original file line number Diff line number Diff line change 1+ // we don't want to warn until [email protected] is actually released 2+ export const reactDomSixteenPointNineIsReleased = false
You can’t perform that action at this time.
0 commit comments