Skip to content

Commit fb0bac1

Browse files
committed
test case
1 parent d55abb7 commit fb0bac1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useEffect, useRef, isValidElement, cloneElement } from 'react';
22
import { supportRef } from 'rc-util/lib/ref';
33
import findDOMNode from 'rc-util/lib/Dom/findDOMNode';
4+
import canUseDom from 'rc-util/lib/Dom/canUseDom';
45
import DomWrapper from './wapper';
56

67
const INTERNAL_PREFIX_KEY = 'rc-mutation-observer-key';
@@ -32,6 +33,9 @@ const MutateObserver: React.FC<MutationObserverProps> = props => {
3233
};
3334

3435
useEffect(() => {
36+
if (!canUseDom()) {
37+
return;
38+
}
3539
const currentElement = findDOMNode(wrapperRef.current!);
3640
if (currentElement && 'MutationObserver' in window) {
3741
instance.current = new MutationObserver(onMutate);

0 commit comments

Comments
 (0)