-
Notifications
You must be signed in to change notification settings - Fork 57
Mobile gallery block - Upload options #1610
Description
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 the addToGallery prop described here: WordPress/gutenberg#18262 to remove duplicates via the id prop whenever new media is selected. This is because the collection of image elements is currently keyed on id or url if id 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.