From 149364351c43a772c625b6e56c6139e6478ba21f Mon Sep 17 00:00:00 2001 From: Ella van Durpe Date: Sat, 21 Dec 2019 20:32:28 +0100 Subject: [PATCH] Run selector on every render --- packages/block-editor/src/components/rich-text/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js index 92a2576e77f033..ebdf450fe4a994 100644 --- a/packages/block-editor/src/components/rich-text/index.js +++ b/packages/block-editor/src/components/rich-text/index.js @@ -162,6 +162,9 @@ function RichTextWrapper( { ...extraProps, }; }; + // This selector must run on every render so the right selection state is + // retreived from the store on merge. + // To do: fix this somehow. const { canUserUseUnfilteredHTML, isCaretWithinFormattedText, @@ -171,7 +174,7 @@ function RichTextWrapper( { didAutomaticChange, disabled, shouldBlurOnUnmount, - } = useSelect( selector, [ clientId, identifier, originalIsSelected ] ); + } = useSelect( selector ); const { __unstableMarkLastChangeAsPersistent, enterFormattedText,