wordpress-mobile / wordpress-mobile/WordPress-Android
Local media ids can collide with remote ids
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 3.2k
- Forks
- 1.4k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 69
Description
Description
The local media ids used for not-yet-uploaded media files can collide with remote ids of items in the WordPress Media Library. In most cases, this should not cause a problem, however, situations may exist where the id conflict poses an issue. In particular, we currently deduplicate media items within the gallery block keyed on id, so this could affect user experience for a user uploading new items with local ids that match the ids of items already added.
This issue was previously noted here: https://github.com/wordpress-mobile/gutenberg-mobile/issues/1610
There is a potential solution to this issue here: https://github.com/wordpress-mobile/WordPress-Android/pull/11125, but this may require further investigation to explore alternative solution(s) (another possible solution is mentioned in the PR description).
Update:
This issue has been confirmed to be related to and a possible root cause of https://github.com/wordpress-mobile/gutenberg-mobile/issues/1853.
🥇 Thanks to @cameronvoell and @mchowning:
Steps to reproduce the behavior
- Add an image block and choose to add an image from the media library
- Scroll down to add the earliest image in library
- Switch to html mode and note the id of that earliest image (e.g.
"id": 8) - Close the app, and clear app storage and cache
- Sign back into the app and open a new post
- Repeat the following
([noted id] - 1)times (e.g. 7 times):- Add an image block
- Add an image via "Choose from device" (can be with airplane mode on, which may be quicker)
- Add another image block
- Turn airplane mode off and add an image via "Choose from device"
Expected:
- Upload progress will show the correct image dimmed with a progress bar
Actual:
- The placeholder will show the correct image at first
- The placeholder then shows a generic background (light gray)
- The placeholder then shows the incorrect image (the media library image with the noted id, e.g. 8)
- The placeholder finally shows the correct image after the upload completes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linked Gutenberg Mobile issue 1610 and WordPress-Android PR 11125, including the alternative solution mentioned in the PR description. Reproduce the listed media-library and offline-upload sequence, then verify that local and remote media IDs no longer collide and that upload progress continues to show the correct image.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100