@@ -32,7 +32,7 @@ function getGlobalThis() {
32
32
throw new Error ( 'unable to locate global object' )
33
33
}
34
34
35
- function setReactActEnvironment ( isReactActEnvironment ) {
35
+ function setIsReactActEnvironment ( isReactActEnvironment ) {
36
36
getGlobalThis ( ) . IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment
37
37
}
38
38
@@ -43,7 +43,7 @@ function getIsReactActEnvironment() {
43
43
function withGlobalActEnvironment ( actImplementation ) {
44
44
return callback => {
45
45
const previousActEnvironment = getIsReactActEnvironment ( )
46
- setReactActEnvironment ( true )
46
+ setIsReactActEnvironment ( true )
47
47
try {
48
48
// The return value of `act` is always a thenable.
49
49
let callbackNeedsToBeAwaited = false
@@ -64,24 +64,24 @@ function withGlobalActEnvironment(actImplementation) {
64
64
then : ( resolve , reject ) => {
65
65
thenable . then (
66
66
returnValue => {
67
- setReactActEnvironment ( previousActEnvironment )
67
+ setIsReactActEnvironment ( previousActEnvironment )
68
68
resolve ( returnValue )
69
69
} ,
70
70
error => {
71
- setReactActEnvironment ( previousActEnvironment )
71
+ setIsReactActEnvironment ( previousActEnvironment )
72
72
reject ( error )
73
73
} ,
74
74
)
75
75
} ,
76
76
}
77
77
} else {
78
- setReactActEnvironment ( previousActEnvironment )
78
+ setIsReactActEnvironment ( previousActEnvironment )
79
79
return actResult
80
80
}
81
81
} catch ( error ) {
82
82
// Can't be a `finally {}` block since we don't know if we have to immediately restore IS_REACT_ACT_ENVIRONMENT
83
83
// or if we have to await the callback first.
84
- setReactActEnvironment ( previousActEnvironment )
84
+ setIsReactActEnvironment ( previousActEnvironment )
85
85
throw error
86
86
}
87
87
}
@@ -203,6 +203,10 @@ function asyncAct(cb) {
203
203
}
204
204
205
205
export default act
206
- export { asyncAct , setReactActEnvironment , getIsReactActEnvironment }
206
+ export {
207
+ asyncAct ,
208
+ setIsReactActEnvironment as setReactActEnvironment ,
209
+ getIsReactActEnvironment ,
210
+ }
207
211
208
212
/* eslint no-console:0 */
0 commit comments