From 602abc455157394edd861e8bcbfd6455e6a39133 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 20 May 2022 19:19:42 +0100 Subject: [PATCH 1/3] Improve inline documentation --- docs/reference-guides/data/data-core-block-editor.md | 4 ++-- packages/block-editor/src/store/actions.js | 4 ++-- packages/components/src/autocomplete/index.js | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md index e0e9695a0036a7..4c16e90441c4a6 100644 --- a/docs/reference-guides/data/data-core-block-editor.md +++ b/docs/reference-guides/data/data-core-block-editor.md @@ -1471,11 +1471,11 @@ _Parameters_ ### setBlockVisibility -Action that sets whether a block has controlled inner blocks. +Action that sets whether given blocks are visible on the canvas. _Parameters_ -- _updates_ `Record`: The block's clientId. +- _updates_ `Record`: For each block's clientId, its new visibility setting. ### setHasControlledInnerBlocks diff --git a/packages/block-editor/src/store/actions.js b/packages/block-editor/src/store/actions.js index afb93c40c5d92c..4b117bd5e9bd93 100644 --- a/packages/block-editor/src/store/actions.js +++ b/packages/block-editor/src/store/actions.js @@ -1605,9 +1605,9 @@ export function setHasControlledInnerBlocks( } /** - * Action that sets whether a block has controlled inner blocks. + * Action that sets whether given blocks are visible on the canvas. * - * @param {Record} updates The block's clientId. + * @param {Record} updates For each block's clientId, its new visibility setting. */ export function setBlockVisibility( updates ) { return { diff --git a/packages/components/src/autocomplete/index.js b/packages/components/src/autocomplete/index.js index ff858e7fdc9e56..419d8975caf066 100644 --- a/packages/components/src/autocomplete/index.js +++ b/packages/components/src/autocomplete/index.js @@ -269,6 +269,9 @@ function useAutocomplete( { event.preventDefault(); } + // textContent is a primitive (string), memoizing is not strictly necessary + // but since the autocompleter is a potential bottleneck for the editor type metric + // it's over optimized. const textContent = useMemo( () => { if ( isCollapsed( record ) ) { return getTextContent( slice( record, 0 ) ); From f7dd5aa731c8d32c69b083a971f0a4cc230cac8c Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 23 May 2022 09:01:27 +0100 Subject: [PATCH 2/3] Clarification --- packages/components/src/autocomplete/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/components/src/autocomplete/index.js b/packages/components/src/autocomplete/index.js index 419d8975caf066..577497c114dbab 100644 --- a/packages/components/src/autocomplete/index.js +++ b/packages/components/src/autocomplete/index.js @@ -270,8 +270,8 @@ function useAutocomplete( { } // textContent is a primitive (string), memoizing is not strictly necessary - // but since the autocompleter is a potential bottleneck for the editor type metric - // it's over optimized. + // but this is a preemptive perf improvement, since the autocompleter + // is a potential bottleneck for the editor type metric. const textContent = useMemo( () => { if ( isCollapsed( record ) ) { return getTextContent( slice( record, 0 ) ); From 21754dc10a2154ad406d98d38da0ee408039101e Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 23 May 2022 09:41:57 +0100 Subject: [PATCH 3/3] Fix comment --- packages/components/src/autocomplete/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/autocomplete/index.js b/packages/components/src/autocomplete/index.js index 577497c114dbab..3b052d826e8a41 100644 --- a/packages/components/src/autocomplete/index.js +++ b/packages/components/src/autocomplete/index.js @@ -270,7 +270,7 @@ function useAutocomplete( { } // textContent is a primitive (string), memoizing is not strictly necessary - // but this is a preemptive perf improvement, since the autocompleter + // but this is a preemptive performance improvement, since the autocompleter // is a potential bottleneck for the editor type metric. const textContent = useMemo( () => { if ( isCollapsed( record ) ) {