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
#4808)

Co-authored-by: Jatin Rawat <63788422+Kaku-g@users.noreply.github.com>
  • Loading branch information
sneridagh and Kaku-g authored May 24, 2023
1 parent 1dac0ff commit db63a16
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 db63a16

Please sign in to comment.