Skip to content
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

[Gutenberg] - Cancel failed or in progress uploads if the media block is removed #23125

Merged
merged 3 commits into from
May 16, 2024

Conversation

geriux
Copy link
Member

@geriux geriux commented Apr 30, 2024

Related PRs:

To test follow the instructions in the Gutenberg PR's description.

Regression Notes

  1. Potential unintended areas of impact
    It should only affect the editor

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Manual testing

  3. What automated tests I added (or what prevented me from doing so)
    No automated tests were added.

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing checklist:

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

@geriux geriux added [Status] DO NOT MERGE Gutenberg Editing and display of Gutenberg blocks. labels Apr 30, 2024
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 30, 2024

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr23125-8fb6152
Version24.9
Bundle IDorg.wordpress.alpha
Commit8fb6152
App Center BuildWPiOS - One-Offs #9920
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 30, 2024

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr23125-8fb6152
Version24.9
Bundle IDcom.jetpack.alpha
Commit8fb6152
App Center Buildjetpack-installable-builds #8969
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@kean
Copy link
Contributor

kean commented Apr 30, 2024

Block Removal

I verified the "block removed → upload deleted" scenario. The gutenbergDidRequestMediaUploadCancelation method does get called and the upload gets deleted 👍

If you Undo, it does end up in a somewhat weird state. if it's feasible, it would be great to "reset" the view and ask you to pick a photo again otherwise it seems a bit confusing.

Update: I also tested Video and Gallery blocks.

Upload Progress

I tested the upload progress and thumbnail display with a happy path scenarios and it looks great. But I would suggest to also remove the following lines as they are now redundant:

case .thumbnailReady(let url) where ReachabilityUtils.isInternetReachable() && media.remoteStatus == .failed:
    gutenberg.mediaUploadUpdate(id: mediaUploadID, state: .failed, progress: 0, url: url, serverID: nil)
case .thumbnailReady(let url) where !ReachabilityUtils.isInternetReachable() && media.remoteStatus == .failed:
    // The progress value passed is ignored by the editor, allowing the UI to retain the last known progress before pausing
    gutenberg.mediaUploadUpdate(id: mediaUploadID, state: .paused, progress: 0, url: url, serverID: nil)

My understanding is that the only reason they are there is because the previous Gutenberg method required you to pass the .state on any thumbnail update.

I tested it be removing these lines and it fixed one more issue for me: the app not displaying the thumbnail if the failure happens before the thumbnail is generated. Here's before and after:

Screenshot 2024-04-30 at 1 01 18 PM Screenshot 2024-04-30 at 12 59 24 PM

@geriux
Copy link
Member Author

geriux commented Apr 30, 2024

If you Undo, it does end up in a somewhat weird state. if it's feasible, it would be great to "reset" the view and ask you to pick a photo again otherwise it seems a bit confusing.

Definitely, restoring it to the placeholder would make sense. I'll create a ticket as a follow-up task.

My understanding is that the only reason they are there is because the previous Gutenberg method required you to pass the .state on any thumbnail update.

That's probably the reason yes.

I tested it be removing these lines and it fixed one more issue for me: the app not displaying the thumbnail if the failure happens before the thumbnail is generated. Here's before and after:

Oh wow, let's remove them then! I've also encountered that issue with the empty placeholder. I'll update the PR.

Thank you for the feedback and testing!

@geriux geriux changed the title [Test] - Cancel failed or in progress uploads if the media block is removed [Gutenberg] - Cancel failed or in progress uploads if the media block is removed Apr 30, 2024
@twstokes
Copy link
Contributor

twstokes commented May 6, 2024

👋 @kean and @geriux, semi-related to this topic I added this issue: #23166

Copy link
Contributor

@twstokes twstokes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

… the connection availability, now that the thumbnail is updated sperately from the state and progress.
@geriux geriux force-pushed the gutenberg/remove-upload-on-block-remove branch from b0017cf to 8fb6152 Compare May 16, 2024 16:53
@geriux geriux added this to the 25.0 milestone May 16, 2024
@geriux geriux marked this pull request as ready for review May 16, 2024 16:54
@geriux geriux merged commit bb25916 into trunk May 16, 2024
26 checks passed
@geriux geriux deleted the gutenberg/remove-upload-on-block-remove branch May 16, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Editing and display of Gutenberg blocks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants