Skip to content

Commit

Permalink
Fix Reference & Manager compatibility with React 18's StrictMode (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrusAsikainen authored May 8, 2024
1 parent beac280 commit 2bbdd4a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 1 addition & 0 deletions src/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function Manager({ children }: ManagerProps): React.Node {

const hasUnmounted = React.useRef(false);
React.useEffect(() => {
hasUnmounted.current = false;
return () => {
hasUnmounted.current = true;
};
Expand Down
4 changes: 0 additions & 4 deletions src/Reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export function Reference({ children, innerRef }: ReferenceProps): React.Node {
[innerRef, setReferenceNode]
);

// ran on unmount
// eslint-disable-next-line react-hooks/exhaustive-deps
React.useEffect(() => () => setRef(innerRef, null), []);

React.useEffect(() => {
warning(
Boolean(setReferenceNode),
Expand Down

0 comments on commit 2bbdd4a

Please sign in to comment.