Skip to content

Commit

Permalink
Merge pull request #675 from thebuilder/fix/deprecated-react-dom-act
Browse files Browse the repository at this point in the history
fix: support old act from react-dom
  • Loading branch information
thebuilder authored May 3, 2024
2 parents a0566eb + 0dbb29c commit 436fe6d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { act } from "react";
import * as React from "react";
import * as DeprecatedReactTestUtils from "react-dom/test-utils";

declare global {
var IS_REACT_ACT_ENVIRONMENT: boolean;
}

const act =
typeof React.act === "function" ? React.act : DeprecatedReactTestUtils.act;

type Item = {
callback: IntersectionObserverCallback;
elements: Set<Element>;
Expand Down

0 comments on commit 436fe6d

Please sign in to comment.