-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile gallery block - Upload options #1610
Comments
Recently investigated a call that was failing due to the whole using-the-local-id behavior you're discussing here. Basically we are making a call to request media info for an image before the image id has been updated from the local id, which fails (although, like you note, it could succeed if the id happened to match an image already on web). Turns out this particular error appears to not have any significant user impact because as soon as we do get the new (proper) id from the web, we retry the call with that id. wordpress-mobile/WordPress-Android#10779 (comment) |
Thanks @mchowning for confirming that local <-> remote In the case for gallery, the colliding Current state of
User adds some local images:
After deduping, we'd have gallery images state as:
So, the 🐒 monkey will not appear in the gallery, blocked by the 🐈 cat. One solution is to modify the deduping logic, while another would be to modify the way we generate local-ids to prevent the possibility of collisions. |
Test BuildsBuilds are open for testing on these draft PRs:
Uploading Test CasesWordPress-Android
WordPress-iOS
|
@koke Could you help detecting the root cause of this one? |
It took me a while to get it running, but there's no mystery, it's just what the code is explicitly doing: // Append the first item via callback given by Gutenberg.
if let firstItem = assets.first {
insertOnBlock(with: firstItem)
}
// Append the rest of images via `.appendMedia` event.
// Ideally we would send all picked images via the given callback, but that seems to not be possible yet.
appendOnNewBlocks(assets: assets.dropFirst()) |
@mkevins Had a chance to review and jotted down some notes/feedback. I also saw some of what has already been pointed out, but some other minor things. Both
Android
iOS
|
@mkevins Just validated this issue I'm running |
PR is opened for the gallery upload iOS issue |
This was an error in my environment. Double checked with https://36287-9306568-gh.circle-artifacts.com/0/Artifacts/WordPress-pr-11234-build-36287.apk and it's working now. ✅ |
It's looking good @mkevins! Tested on: https://36287-9306568-gh.circle-artifacts.com/0/Artifacts/WordPress-pr-11234-build-36287.apk So far these cases are passing for me: And I had one error: Retry All seems to do nothing
Result: The image still displays the "Failed to insert media. Please tap for options" |
Thanks @iamthomasbishop for testing this out and providing great feedback! These remaining issues are not related specifically to this PR, so I'll open new issues for them to be tackled in another PR(s).
|
Sounds good! 👍 Thanks for wrangling that! |
This aims to track issues related to uploading media from the Gallery block. It is part of this issue: #1416.
Test Builds
Builds are open for testing on these draft PRs:
WordPress-Android
: Enable gallery upload options in production WordPress-Android#11234 (comment)WordPress-iOS
: Enable gallery upload options in production WordPress-iOS#13374 (comment)Media uploading and ids
In the current state, the
MediaPlaceholder
component utilizes theaddToGallery
prop described here: WordPress/gutenberg#18262 to remove duplicates via theid
prop whenever new media is selected. This is because the collection of image elements is currently keyed onid
orurl
ifid
is not defined.When a media item is local (i.e. not finished uploading, in the case of adding media from device), it may have a temporary local id. This can result in "collisions" (i.e. the local id of a newly added and currently uploading media item being equal to the "server id" of an already uploaded item within the same gallery).
One way to address this is to negate the local media id over the bridge (both directions), this way, the media models / database on WordPress-Android will not require updating, and the Gutenberg (JavaScript) side will not see collisions. I'd love to know if there are alternative approaches to solving this as well.
Update: The collision id issue has been confirmed with steps here.
The text was updated successfully, but these errors were encountered: