Skip to content

Commit

Permalink
Add check for lightbox values during image block migration (#56057)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiomorales authored and mikachan committed Nov 13, 2023
1 parent 4c1f4d4 commit 370fd4f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/block-library/src/image/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,14 @@ const v8 = {
},
},
migrate( { width, height, ...attributes } ) {
// We need to perform a check here because in cases
// where attributes are added dynamically to blocks,
// block invalidation overrides the isEligible() method
// and forces the migration to run, so it's not guaranteed
// that `behaviors` or `behaviors.lightbox` will be defined.
if ( ! attributes.behaviors?.lightbox ) {
return attributes;
}
const {
behaviors: {
lightbox: { enabled },
Expand Down

1 comment on commit 370fd4f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 370fd4f.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6854408286
📝 Reported issues:

Please sign in to comment.