Skip to content

Commit

Permalink
fixed the issue #4660 - shouldn't use a hook like function name for …
Browse files Browse the repository at this point in the history
…a variable (#4693)

Co-authored-by: Víctor Fernández de Alba <sneridagh@gmail.com>
  • Loading branch information
Kaku-g and sneridagh authored May 23, 2023
1 parent 4b1bbe0 commit 6e5f0ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/4693.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the issue "shouldn't use a hook like function name for a variable" @Kaku-g
7 changes: 4 additions & 3 deletions packages/volto-slate/src/blocks/Text/SlashMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 })
Expand Down Expand Up @@ -150,7 +150,8 @@ const PersistentSlashMenu = ({ editor }) => {
intl,
properties,
slashCommand,
useAllowedBlocks,
hasAllowedBlocks
,
],
);

Expand Down

0 comments on commit 6e5f0ec

Please sign in to comment.