Wp-calypso: Gallery block: adding/editing additional gallery blocks clears existing galleries

Created on 10 Jan 2019  ·  40Comments  ·  Source: Automattic/wp-calypso

In pages that have multiple gallery blocks, editing or adding a gallery will clear out all other galleries in that page. This also can occur when adding images to the Media Library while creating a new gallery block.

Please note: I have also seen this issue (#1708002-zen) where a user simply tries to edit an existing gallery. The Media Library briefly appears, and then all gallery blocks are empty again. Animated GIF below.

Steps to reproduce

  1. Add Page
  2. Add a gallery block (or two)
  3. Add another gallery block, this time inserting new images into the Media Library
  4. Click on Insert (or Cancel), and notice the existing gallery blocks have been cleared of their images

What I expected

I expected to be able add multiple gallery blocks, and edit existing blocks, so that my page contains multiple galleries.

What happened instead

The existing gallery blocks in the Page were all cleared of their content. The blocks remained, just not the images (except for the new block).

Browser / OS version

  • OS: macOS 10.14.2
  • Browser: Chrome
  • Version: 71.0.3578.98

Screenshot / Video

Context / Source

Bug was discovered by: #manual-testing, #user-report

[Goal] Gutenberg [Type] Bug

Most helpful comment

@simison everything seems to point to a problem on the media library itself, so hopefully yes, there will be a single fix for every block with a media dependency 😉

All 40 comments

@rodrigoi I'm assuming the fix is going to be in how Calypso-Gutenberg handles media and thus if Tiled Gallery block (or future Slider block) are affected, they'll get fixed at the same time?

@simison everything seems to point to a problem on the media library itself, so hopefully yes, there will be a single fix for every block with a media dependency 😉

I am seeing this issue on #1708591-zen it appears too.

GIF: https://cld.wthms.co/wDJExO

Another report of this here: #1712989-zen.

Another report can be seen at #1713278-zen.

Another report here: #1715066-zen

Another report here: #1717379-zen

@mmtr I've been sitting on this for a few days trying to work out options to save the code from #29791, because as you pointed out, it's not only related, it is the source of the problem.

I think we have overengineered the problem a bit, and we don't really need to refresh all the blocks when something changes on the media. I think we can safely remove that code and live with blocks preserving deleted images.

We are moving away from Gutenlypso and this is not a problem with Calypsoify, we can leave this on the backlog.

What do you think?

@rodrigoi We're not updating all the blocks, we're just updating the ones containing changed images so I think that the source of the problem is something else, probably related to the fact that we have 2 different stores handling the media (Calypso and Core) and they're not sync.

In any case and since we're moving away from Gutenlypso I agree that we can remove that code and live with blocks preserving the images.

Tested this on a user site and I can now add or edit multiple Galleries on a page or post without the galleries going blank. Is it safe to assume this issue is resolved?

I was testing this on user's site on #1708591-zen, on the page named "Completed Projects" and are able to reproduce this.

Another report: 1754419-zen

Another report from the forums

Affected page: https://palmos.info/photos-playback-%cf%88/

Another report in #9835814-hc

A report from the forums

Another report in #1755586-zen reproduced on their test draft "Gallery Testing"

Another report here #1770830-zen

Another user reported this in #9567432-HC. I was able to reproduce it on my site (by copying user's content): http://cld.wthms.co/zTo4AD

Another user reported in #1759009-zen

Another report for simple site in #1787750-zen

Another report for a simple site using Firefox: #3394182-hc
A workaround is to use a Classic Block and add a gallery within it.

Another report in 1803107-zen

As above, suggested keeping the galleries in a classic block.

Two more cases: #1810291-zen and #1810276-zen

Another report here: 10063254-hc

Another report in 1820175-zen

Another report in 10676047-hc

Returning user regarding this issue looking for an update 1826270-zen (original 1803107-zen)

Another report of this in #1791348-zen. The user said that the gallery is removed when using old images but not new ones.

Videos submitted by user:
Creating new post with gallery (of old photos) and adding image (shows bug)
https://youtu.be/YcT4orV3ejU

And then the same process with recent photos (no bug)
https://youtu.be/FJMRUhTImrU

I have another user who reported the problem in #10653491-hc

Page in question:
/tour-salzburg-nach-bad-gastein/

Another: 1833694-zen

Another report in 1838588-zen

Reported in 9497905-hc

Another report in #1842633-zen

Another report here: 10898256-hc

Another report here: 1849325-zen

Thanks everyone for the patience. This should have been fixed when we deployed #31196. Please reopen if there's another report.

Hurrah! Thanks for the update @rodrigoi!

Another report in 2385061-zen. Pre-existing images in a Gallery Block become un-checked when adding new images to the same Gallery and hence become missing.

I'm having trouble breaking the Gallery block, closing this issue since the original problem was fixed.

@zdenys if you're still seeing this behavior do you mind filing a fresh issue with steps, or a quick screenshot or video for more hints on reproducing?

Was this page helpful?
0 / 5 - 0 ratings