Skip to content

Commit

Permalink
Avoid backend JavaScript exception with accordion block (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
albig authored Aug 6, 2024
1 parent 55cd824 commit 4671996
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/accordion/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { __ } from '@wordpress/i18n';
import { useBlockProps, RichText } from '@wordpress/block-editor';

import { TextControl } from '@wordpress/components';
import { useEffect } from '@wordpress/element';

/**
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
Expand All @@ -40,7 +41,9 @@ export default function Edit( { attributes, setAttributes, clientId } ) {
className: 'accordion',
} );

setAttributes( { blockId: clientId } );
useEffect( () => {
setAttributes( { blockId: clientId } );
}, [ clientId, setAttributes ] );

const onChangeContent = ( newContent ) => {
setAttributes( { content: newContent } );
Expand Down

0 comments on commit 4671996

Please sign in to comment.