Skip to content

Commit 6e36177

Browse files
committed
remove withCleanup helper
1 parent 8fcd546 commit 6e36177

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

src/profile/disableActWarnings.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import { withCleanup } from "./withCleanup.js";
2-
31
/**
42
* Temporarily disable act warnings.
53
*
64
* https://github.com/reactwg/react-18/discussions/102
75
*/
86
export function disableActWarnings() {
9-
const prev = { prevActEnv: (globalThis as any).IS_REACT_ACT_ENVIRONMENT };
10-
(globalThis as any).IS_REACT_ACT_ENVIRONMENT = false;
7+
const anyThis = globalThis as any;
8+
const prevActEnv = anyThis.IS_REACT_ACT_ENVIRONMENT;
9+
anyThis.IS_REACT_ACT_ENVIRONMENT = false;
1110

12-
return withCleanup(prev, ({ prevActEnv }) => {
13-
(globalThis as any).IS_REACT_ACT_ENVIRONMENT = prevActEnv;
14-
});
11+
return {
12+
[Symbol.dispose]() {
13+
anyThis.IS_REACT_ACT_ENVIRONMENT = prevActEnv;
14+
},
15+
};
1516
}

src/profile/withCleanup.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)