Skip to content

Commit

Permalink
cleanup + ensure we unbind the event
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasztunik committed Mar 9, 2022
1 parent 552ac83 commit 1473350
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function Iframe(
const { contentDocument, ownerDocument } = node;
const { readyState, documentElement } = contentDocument;

if ( readyState !== 'complete' && readyState !== 'interactive' ) {
if ( readyState !== 'interactive' && readyState !== 'complete' ) {
return false;
}

Expand Down Expand Up @@ -204,9 +204,9 @@ function Iframe(
}

// Document set with srcDoc is not immediately ready.
node.addEventListener( 'load', () => {
setDocumentIfReady();
} );
node.addEventListener( 'load', setDocumentIfReady );

return () => node.removeEventListener( 'load', setDocumentIfReady );
}, [] );
const headRef = useRefEffect( ( element ) => {
scripts
Expand Down

0 comments on commit 1473350

Please sign in to comment.