wordpress-mobile / gutenberg-mobile

Mobile version of Gutenberg - native iOS and Android
GNU General Public License v2.0
248 stars 56 forks source link

Uploading new image "overwrites" different image #1896

Open mchowning opened 4 years ago

mchowning commented 4 years ago

Describe the bug On Android, when an image in a post has a remote id (for example, 12) that conflicts with the local id assigned to a newly added image, upon completion of uploading the newly added image, both of the images with the matching id (12) will be overwritten with the newly added image.

To Reproduce Steps to reproduce the behavior:

  1. Open a post with an image block with an image that has a remote id 1 greater than the last local id.
  2. Add a new image block to the post
  3. Add an image from the device to the image block (so it will be assigned a local id matching the remote id of the already-present image block)
  4. Observe that both images are updated visually and that the html for both blocks reflects the newly added image

Expected behavior Adding an image to an image block should not affect the images in any other image block.

Screenshots overwrite_image mp4

Smartphone (please complete the following information):

Additional context This is sort of the flip-side of the problem seen in #1853 , which was also due to conflicting image ids (see also https://github.com/wordpress-mobile/WordPress-Android/issues/11239).

I believe this is very much an edge case issue as compared to #1853. That issue only required that you have a local id that conflicted with the remote id of any image in your media library. This issue, by contrast, requires that you have a local id that conflicts with the remote id of an image that has been included in the post you are editing.

mkevins commented 4 years ago

I have reproduced this, and have confirmed this also occurs with other blocks. Any block that uses MediaUploadProgress component will respond to events filtered by id, so this indeed results in the duplicated progress bar indications, as well as incorrect replacement of the media items upon receiving the upload completion event.

mchowning commented 3 years ago

User report of a similar sounding issue:

User on Android mobile app and in a post with a lot of images in image blocks, when they tried to replace one image, it was replacing others in the post with that same image.

3580046-zd-woothemes