Skip to content

Commit 8793f1e

Browse files
author
Kent C. Dodds
committed
fix(act): wait until react-dom-16.9.0 is released
1 parent 5a88da2 commit 8793f1e

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
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",

src/__tests__/old-act.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import {asyncAct} from '../act-compat'
22

3+
jest.mock('../react-dom-16.9.0-is-released', () => ({
4+
reactDomSixteenPointNineIsReleased: true,
5+
}))
6+
37
jest.mock('react-dom/test-utils', () => ({
48
act: cb => {
59
const promise = cb()

src/act-compat.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react'
22
import ReactDOM from 'react-dom'
3+
import {reactDomSixteenPointNineIsReleased} from './react-dom-16.9.0-is-released'
34

45
let reactAct
56
let actSupported = false
@@ -39,7 +40,11 @@ let youHaveBeenWarned = false
3940
// state updates asynchronously, but at least we can tell people they need
4041
// to upgrade to avoid the warnings.
4142
async function asyncActPolyfill(cb) {
42-
if (!youHaveBeenWarned && actSupported) {
43+
if (
44+
!youHaveBeenWarned &&
45+
actSupported &&
46+
reactDomSixteenPointNineIsReleased
47+
) {
4348
// if act is supported and async act isn't and they're trying to use async
4449
// act, then they need to upgrade from 16.8 to 16.9.
4550
// This is a seemless upgrade, so we'll add a warning

src/react-dom-16.9.0-is-released.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// we don't want to warn until [email protected] is actually released
2+
export const reactDomSixteenPointNineIsReleased = false

0 commit comments

Comments
 (0)