From 1eded353f9e3d93565b4f6de9fae2c101a47a9f9 Mon Sep 17 00:00:00 2001 From: Jatin Rawat <63788422+Kaku-g@users.noreply.github.com> Date: Tue, 23 May 2023 22:16:17 +0530 Subject: [PATCH] fixed the issue #4660 - shouldn't use a hook like function name for a variable (#4693) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Víctor Fernández de Alba --- news/4693.bugfix | 1 + packages/volto-slate/src/blocks/Text/SlashMenu.jsx | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 news/4693.bugfix diff --git a/news/4693.bugfix b/news/4693.bugfix new file mode 100644 index 0000000000..b0db698661 --- /dev/null +++ b/news/4693.bugfix @@ -0,0 +1 @@ +Fixed the issue "shouldn't use a hook like function name for a variable" @Kaku-g diff --git a/packages/volto-slate/src/blocks/Text/SlashMenu.jsx b/packages/volto-slate/src/blocks/Text/SlashMenu.jsx index 5ca34d2877..6a3c6837c0 100644 --- a/packages/volto-slate/src/blocks/Text/SlashMenu.jsx +++ b/packages/volto-slate/src/blocks/Text/SlashMenu.jsx @@ -110,7 +110,7 @@ const PersistentSlashMenu = ({ editor }) => { const [slashMenuSelected, setSlashMenuSelected] = React.useState(0); - const useAllowedBlocks = !isEmpty(allowedBlocks); + const hasAllowedBlocks = !isEmpty(allowedBlocks); const slashCommand = data.plaintext ?.toLowerCase() .trim() @@ -119,7 +119,7 @@ const PersistentSlashMenu = ({ editor }) => { const availableBlocks = React.useMemo( () => filter(blocksConfig, (item) => - useAllowedBlocks + hasAllowedBlocks ? allowedBlocks.includes(item.id) : typeof item.restricted === 'function' ? !item.restricted({ properties, block: item }) @@ -150,7 +150,8 @@ const PersistentSlashMenu = ({ editor }) => { intl, properties, slashCommand, - useAllowedBlocks, + hasAllowedBlocks +, ], );