WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.39k stars 4.15k forks source link

Gallery Block: Identical Images Get Duplicated When Moving #30473

Closed sdixon194 closed 3 years ago

sdixon194 commented 3 years ago

Description

When adding the same image to a gallery block, moving adjacent images will duplicate that image multiple times.

Step-by-step reproduction instructions

Please list the steps needed to reproduce the bug. For example:

  1. Add a gallery block
  2. Add two images that are the same next to each other.
  3. Try and use the arrows on an adjacent image to move it over.
  4. Watch the other image take over the gallery.

Expected behaviour

The images to just swap positions normally.

Actual behaviour

Another image was duplicated instead.

Screenshots or screen recording (optional)

Easier to see with this:

ezgif com-optimize

WordPress information

Device information

Mamaduka commented 3 years ago

I was able to reproduce the issue.

To add the same image multiple times in a gallery, you'll have to edit the gallery item and select the image.

I guess that this happens because children will have the same key prop.