Skip to content

DimensionsTool dropdown in Core/Image block does not update when block attribute changes externally #71816

@rohitp-bsf

Description

@rohitp-bsf

Description

When updating the aspectRatio attribute of a Core/Image block externally via wp.data.dispatch('core/block-editor').updateBlockAttributes, the block attribute updates correctly, but the visible dropdown in the block settings (DimensionsTool) does not reflect the new value.

The issue occurs because DimensionsTool is a controlled React component, and updating the attribute externally does not trigger a re-render of the dropdown UI.

Step-by-step reproduction instructions

Steps to Reproduce:

Insert an Image block in the editor.

Open the browser console and run:

wp.data.dispatch('core/block-editor').updateBlockAttributes(
    'BLOCK_ID_HERE',
    { aspectRatio: '1/1' }
);

Check that the aspectRatio attribute in the block has updated.

Notice that the Aspect Ratio dropdown in the block sidebar does not visually update.

Screenshots, screen recording, code snippet

Link: https://bsf.d.pr/v/Uy9AKU

Environment info

  • WordPress version: latest
  • Gutenberg version: latest
  • Browser: Chrome / Firefox (latest)

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] ImageAffects the Image Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions