From 8703eb29d8cdf56a93172a3812675cd847ca7ea6 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Thu, 28 Dec 2023 20:57:50 +0200 Subject: [PATCH] Performance: Avoid extra `useMarkPersistent` dispatch calls --- .../src/components/rich-text/use-mark-persistent.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/rich-text/use-mark-persistent.js b/packages/block-editor/src/components/rich-text/use-mark-persistent.js index 9a564dfb7f97e..10e157452fbe2 100644 --- a/packages/block-editor/src/components/rich-text/use-mark-persistent.js +++ b/packages/block-editor/src/components/rich-text/use-mark-persistent.js @@ -11,8 +11,7 @@ import { store as blockEditorStore } from '../../store'; export function useMarkPersistent( { html, value } ) { const previousText = useRef(); - const hasActiveFormats = - value.activeFormats && !! value.activeFormats.length; + const hasActiveFormats = !! value.activeFormats?.length; const { __unstableMarkLastChangeAsPersistent } = useDispatch( blockEditorStore );