From d6024dcd64da636c7010ec2bba6e2e50970ae4ed Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 28 Feb 2020 16:55:53 -0500 Subject: [PATCH 1/2] Block Editor: Clear toolbar timeout by ref on unmount --- packages/block-editor/src/components/block-toolbar/utils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/block-editor/src/components/block-toolbar/utils.js b/packages/block-editor/src/components/block-toolbar/utils.js index 7f7accf7c8784b..de44e2d69641b0 100644 --- a/packages/block-editor/src/components/block-toolbar/utils.js +++ b/packages/block-editor/src/components/block-toolbar/utils.js @@ -59,6 +59,8 @@ export function useDebouncedShowMovers( { [ isFocused ] ); + useEffect( () => () => clearTimeout( timeoutRef.current ) ); + return { showMovers, debouncedShowMovers, From 02eb218d97045a35ad3fde9b1c0c2210aad9f379 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Mon, 2 Mar 2020 13:02:07 +0100 Subject: [PATCH 2/2] Add 2nd param to useEffect call --- packages/block-editor/src/components/block-toolbar/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-toolbar/utils.js b/packages/block-editor/src/components/block-toolbar/utils.js index de44e2d69641b0..da64ca0bfb3488 100644 --- a/packages/block-editor/src/components/block-toolbar/utils.js +++ b/packages/block-editor/src/components/block-toolbar/utils.js @@ -59,7 +59,7 @@ export function useDebouncedShowMovers( { [ isFocused ] ); - useEffect( () => () => clearTimeout( timeoutRef.current ) ); + useEffect( () => () => clearTimeout( timeoutRef.current ), [] ); return { showMovers,