Skip to content

Commit

Permalink
Components: Fix the cleanup method for SandBox (#53796)
Browse files Browse the repository at this point in the history
* Components: Fix the cleanup method for SandBox

* Update changelog

---------

Co-authored-by: Lena Morita <lena@jaguchi.com>
  • Loading branch information
Mamaduka and mirka committed Aug 18, 2023
1 parent e0916da commit 17bc4c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Bug Fix

- `SandBox`: Fix the cleanup method in useEffect ([#53796](https://github.com/WordPress/gutenberg/pull/53796)).

## 25.6.0 (2023-08-16)

### Enhancements
Expand Down
5 changes: 4 additions & 1 deletion packages/components/src/sandbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ function SandBox( {

return () => {
iframe?.removeEventListener( 'load', tryNoForceSandBox, false );
defaultView?.addEventListener( 'message', checkMessageForResize );
defaultView?.removeEventListener(
'message',
checkMessageForResize
);
};
// Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
// See https://github.com/WordPress/gutenberg/pull/44378
Expand Down

0 comments on commit 17bc4c2

Please sign in to comment.