Skip to content

Commit

Permalink
move empty array out of useSelect, add empty dependency array
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Oct 25, 2024
1 parent 163068b commit 7bcb7c0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/html/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ const DEFAULT_STYLES = `

export default function HTMLEditPreview( { content, isSelected } ) {
const settingStyles = useSelect(
( select ) => select( blockEditorStore ).getSettings().styles || []
( select ) => select( blockEditorStore ).getSettings().styles,
[]
);

const styles = useMemo(
() => [
DEFAULT_STYLES,
...transformStyles(
settingStyles.filter( ( style ) => style.css )
( settingStyles ?? [] ).filter( ( style ) => style.css )
),
],
[ settingStyles ]
Expand Down

0 comments on commit 7bcb7c0

Please sign in to comment.