Skip to content

Commit

Permalink
Run selector on every render
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Dec 25, 2019
1 parent fb3dbcb commit 1493643
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -171,7 +174,7 @@ function RichTextWrapper( {
didAutomaticChange,
disabled,
shouldBlurOnUnmount,
} = useSelect( selector, [ clientId, identifier, originalIsSelected ] );
} = useSelect( selector );
const {
__unstableMarkLastChangeAsPersistent,
enterFormattedText,
Expand Down

0 comments on commit 1493643

Please sign in to comment.