WordPress-iOS icon indicating copy to clipboard operation
WordPress-iOS copied to clipboard

Error when undo-ing move to bin for a post/page with featured image on self-hosted site

Open jostnes opened this issue 4 years ago • 5 comments

Expected behavior

User should not get an error message after undo

Actual behavior

Error message is displayed:

https://user-images.githubusercontent.com/17252150/129438593-c985901d-c099-4d65-a6a1-77bdb23c30d1.MP4

Steps to reproduce the behavior

  1. Create post/page on a self-hosted site
  2. Add an image, make it a Featured Image on the post/page and publish
  3. Go to Posts/Pages list screen and delete (move to bin) the post/page
  4. Tap undo
  5. Error is displayed (Error – Invalid attachment ID)
Tested on [device], iOS [version], WPiOS [version]

Tested on iPhone 11, iOS 14.6, WPiOS 18.0

jostnes avatar Aug 14 '21 07:08 jostnes

Very intermittent failure; I think that the longer you wait before pressing undo, the more likely it is to happen. Couldn't make it happen on simulator at all.

My guess (from the time difference) is that the server hasn't yet had a chance to delete the attachment when the undo is pressed if you press it quickly and so the error doesn't pop up.

illusaen avatar Sep 07 '21 16:09 illusaen

I could not reproduce the issue even once:

  • Tested with pages and posts
  • Tested on Simulator and iPhone
  • Tested on different self-hosted site providers
  • Tested with small and large featured images & gifs
  • Tested various network conditioning scenarios
  • Undoing quickly and undoing after waiting for an extended period of time
  • Moving to the trash and undoing multiple post/pages at the same time

I see that previously the issue could not be reproduced reliably (or at all) as well.

@jostnes are you still able to reproduce this issue? If yes, maybe there's some setup details that increase the likelihood of issue happening? If no, we should consider closing the issue.

staskus avatar Sep 12 '22 09:09 staskus

Hey @staskus thanks for looking into this issue. I just tried this again using a newly created test site and was able to reproduce it quite easily on Pages but not on Posts, here's a screen recording (using WP v20.7 on iPhone 13 mini):

https://user-images.githubusercontent.com/17252150/189807847-1752c8e4-cdca-4532-b274-5bcc4751576a.MP4

Adding more specific steps:

  1. Create 2 pages and add 2 images to the pages (I selected an image from Free GIF Library > search for Pokemon)
  2. Make the second image the feature image
  3. On the Published Pages tab, trash the page using Move to Bin
  4. Tap on Undo - See error (does not happen to all pages but in my test, it always happens to the same page (Page 2 in screen recording))

jostnes avatar Sep 13 '22 04:09 jostnes

@jostnes, thanks for taking look at it so quickly! I'll try to recreate the exact same setup.

staskus avatar Sep 13 '22 05:09 staskus

I cannot continue working on this issue for now. Unassigning for now.

staskus avatar Sep 13 '22 14:09 staskus

It took me a little to reproduce this issue. The steps in https://github.com/wordpress-mobile/WordPress-iOS/issues/17032#issuecomment-1244880710 weren't working for me.

After trying various different things, I ended up with something close that worked every time for me:

  1. Create a page with 2 images on it
  2. Make the second image the feature image
  3. Publish
  4. Edit the page again
  5. Make the first image the feature image
  6. Save the page
  7. Trash the page and hit undo

https://user-images.githubusercontent.com/2454408/193365348-85354a99-769f-435a-826f-d42704eca4ba.mp4

The API is returning a 404 so I tried looking at the parameters and extraParameters in the updatePost function to see if we're sending any bad data. I compared a post with a successful response to the undo that's causing the error but it looks like they're both sending valid data.

Unfortunately, I don't have more time to work on this (forgot to assign it to myself 😅) so I'll be stopping for now.

wargcm avatar Sep 30 '22 23:09 wargcm