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 +, ], );