@@ -58,7 +58,6 @@ function Frame({
5858 const [ iframeLoaded , setIframeLoaded ] = useState ( false ) ;
5959 const internalRef = useRef < HTMLIFrameElement | null > ( null ) ;
6060 const nodeRef = externalRef || internalRef ;
61- const isMounted = useRef ( false ) ;
6261 const loadCheckInterval = useRef < ReturnType < typeof setInterval > | null > ( null ) ;
6362
6463 const getDoc = useCallback ( ( ) : Document | null => {
@@ -85,8 +84,6 @@ function Frame({
8584 } , [ iframeLoaded ] ) ;
8685
8786 useEffect ( ( ) => {
88- isMounted . current = true ;
89-
9087 const doc = getDoc ( ) ;
9188 const frame = nodeRef . current ;
9289 const interval = loadCheckInterval . current ;
@@ -96,8 +93,6 @@ function Frame({
9693 }
9794
9895 return ( ) => {
99- isMounted . current = false ;
100-
10196 if ( frame ?. contentWindow ) {
10297 frame . contentWindow . removeEventListener ( 'DOMContentLoaded' , handleLoad ) ;
10398 }
@@ -106,15 +101,11 @@ function Frame({
106101 clearInterval ( interval ) ;
107102 }
108103 } ;
109- // nodeRef is stable (either internalRef from useRef or external ref from props)
104+ // nodeRef is a ref and should not be in dependencies per React best practices
110105 // eslint-disable-next-line react-hooks/exhaustive-deps
111106 } , [ getDoc , handleLoad ] ) ;
112107
113108 const renderFrameContents = ( ) : ReactNode => {
114- if ( ! isMounted . current ) {
115- return null ;
116- }
117-
118109 const doc = getDoc ( ) ;
119110
120111 if ( ! doc ) {
0 commit comments