Wordpress-android: Posts List: a duplicate item is displayed in the post list while the post is being uploaded

Created on 13 Nov 2018  路  14Comments  路  Source: wordpress-mobile/WordPress-Android

Expected behavior

When the user pulls-to-refresh while a post is uploading the item is not duplicated.

Actual behavior

When the user pulls-to-refresh while a post is uploading the item is duplicated.

Steps to reproduce the behavior

  1. Go to Post List
  2. Click on the + fab
  3. Add title
  4. Publish post
  5. Pull-to-refresh before the uploading of the post finishes
  6. Notice the new post is duplicated - once in a uploading state and once in a regular state
Tested on [device], Android [version]

Pixel 2, Android 9

UPDATE: 3rd of June 2019
This issue doesn't result in two instances of the same post being uploaded to the server. As soon as the upload finishes the two items/rows in the post list merge into one. It's just an UI/UX issue where the same item is displayed twice during an ongoing upload.

Post List [Pri] Low [Type] Bug

Most helpful comment

Thank you for taking care of this, @malinajirka! It looks like you don't need anything from me in regards to this issue. Please let me know if I missed one.

All 14 comments

I just want to add a quick note here that I was unable to reproduce this issue when I was working on the post list. I have seen it happen a few times, but couldn't figure out why it was happening.

Here are a couple potential reasons to explore:

  • We might be showing both a local post and a remote post at the same time. This could potentially happen if the request to fetch the post finishes before the push_post action completes in which case the local copy of the post won't be updated a new one is inserted. I am not 100% sure about this behavior, but I think this scenario is a possibility.
  • I've seen multiple local posts to be inserted at the same time before which would be unrelated to post list. Maybe somehow it's connected to this.

I've seen this happen several times as well, though I can't reproduce consistently. Most frequently, I see this when I've just created a new post, so I'd lean towards @oguzkocer's first theory.

duplicated_list_item

This is a gif with the issue. However, the priority of the issue with the Post Filters projects is very low, since the duplicates are shown in different tabs and only for a couple of seconds.

This was reported by a user saying:

Everything works fine until it gets long and lots of media added. Now it shows two identical blogs in my list.

On my blog the latest post (still a draft which I'm still editing) has for some reason duplicated itself. There is no way I did that.

(internal references: p4a5px-2om-p2/#comment-9755 and 1953510-zen)

@designsimply I believe the issue user reported is related to https://github.com/wordpress-mobile/WordPress-Android/issues/9347.

This ticket doesn't actually create two instances of the post on the server, it just shows two items in the list for the same post. But as soon as the upload finishes only one item is shown. Feel free to update the title/description to make it more clear ;).

Tested a different scenario that I think is the same issue. I used Pixel 3 with Android 9.0, using the branch from https://github.com/wordpress-mobile/WordPress-Android/pull/9962. I can confirm that the issue is not caused by that PR.

This is tricky to reproduce. I can sometimes reproduce it with these steps.

  1. Start with a Site with no draft posts.
  2. Create a post.
  3. Enter a title.
  4. Go offline.
  5. Exit the editor.
  6. While in the Post List, go online. Let the automatic sync finish.

Repeat steps 2 to 6. Eventually, the duplicate upload happens.

This GIF shows that I was able to reproduce on the first try.

@maxme @malinajirka I changed the priority to High and added this to the Offline Support project. Please feel free to change it back if you disagree. 馃檪

I believe Maxime is right that this is a race condition. Probably in UploadService?

Tested a different scenario that I think is the same issue. I used Pixel 3 with Android 9.0, using the branch from #9962. I can confirm that the issue is not caused by that PR.

@shiki I believe this is not related to this issue. This issue doesn't actually create two instances of the same post on the server. It just displays two duplicate items in the list while the post is being uploaded. As you can see on the following gif
https://github.com/wordpress-mobile/WordPress-Android/issues/8594#issuecomment-479048641 as soon as the upload finishes, the list items merge into one. I'd probably vote for closing this issue as it basically disappeared with introduction of sectioned post list (published/drafts/scheduled/trashed).

It seems it might be related to https://github.com/wordpress-mobile/WordPress-Android/issues/9347 though. But I'm not sure since the steps differ a bit. We might want to either create a new issue or move it to #9347. Wdyt?

Feel free to update the title/description to make it more clear ;).

Okay! 馃憤

I'm updating the priority of this ticket to "Low". This https://github.com/wordpress-mobile/WordPress-Android/issues/9347 is the ticket which should have high priority. See my comments above with explanation.

I've tried to reproduce this issue on a branch with fix for https://github.com/wordpress-mobile/WordPress-Android/issues/9347. The issue this ticket is about is still present, but seems extremely minor.
As you can see on the following gif. If I create a draft and I manually pull-to-refresh before the upload finishes, a loading item with shimmer effect is sometimes displayed. When the upload finishes the loading items transforms into the item which was being uploaded.
bug

Thank you for taking care of this, @malinajirka! It looks like you don't need anything from me in regards to this issue. Please let me know if I missed one.

I might get a report related to this: 2463838-zen

Their words:

Yes, I have published from many, many locations (Wifi vs data, etc...), and the same issue occurs.

This has also spanned multiple Android devices, starting with the Nexus 6P, then to the Pixel 2, then finally the Pixel 3, running Android 10 (current).

User device info:

WordPress - 13.4 - Version code: 784
Android device name: Google Pixel 3

They send a debug log in the above reference. I have also put some details on the note.

I'm asking them to update to 13.5 and check the problem again.

Also, I'm confirming with them if they're doing the pull-to-refresh while the post is being uploaded. to match the condition mentioned here.

UPDATE: user replied with saying:

I may have refreshed the list; would that have caused the app to post multiples?

Another report in 2721292-zen, still with the full duplicate in the posts list.

Was this page helpful?
0 / 5 - 0 ratings