Skip to content

Commit

Permalink
Add security checks
Browse files Browse the repository at this point in the history
  • Loading branch information
cbravobernal committed Aug 27, 2024
1 parent 0691f70 commit 9e98a29
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/block-editor/src/utils/block-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ export function useBlockBindingsUtils() {
* ```
*/
const updateBlockBindings = ( bindings ) => {
const {
metadata: { bindings: currentBindings, ...metadata },
} = getBlockAttributes( clientId );
const { metadata: { bindings: currentBindings, ...metadata } = {} } =
getBlockAttributes( clientId );
const newBindings = { ...currentBindings };

Object.entries( bindings ).forEach( ( [ attribute, binding ] ) => {
Expand Down Expand Up @@ -87,9 +86,8 @@ export function useBlockBindingsUtils() {
* ```
*/
const removeAllBlockBindings = () => {
const {
metadata: { bindings, ...metadata },
} = getBlockAttributes( clientId );
const { metadata: { bindings, ...metadata } = {} } =
getBlockAttributes( clientId );
updateBlockAttributes( clientId, {
metadata: isObjectEmpty( metadata ) ? undefined : metadata,
} );
Expand Down

0 comments on commit 9e98a29

Please sign in to comment.