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

[Mobile]Fix image upload progress not being displayed on the second time #14799

Merged
merged 3 commits into from
Apr 4, 2019

Conversation

pinarol
Copy link
Contributor

@pinarol pinarol commented Apr 3, 2019

Description

To fix: wordpress-mobile/gutenberg-mobile#809

I had updated the upload listener to get started on componentDidMount and get removed at componentDidMount. Comparing to previous, new version will sometimes listen to upload events unnecessarily, but if I am not missing sth that's also the case when we have multiple image blocks uploading in parallel, we'll have some unrelated mediaUpload events coming in that case too. We trust the below check to ignore complications, it looked to me as we can lean on this and use a simpler logic for adding&removing listener for media upload events. Please correct me if I am missing sth because I might be :)

	mediaUpload( payload ) {
		const { attributes } = this.props;

		if ( payload.mediaId !== attributes.id ) {
			return;
		}

How has this been tested?

Tested with Parent PR: wordpress-mobile/gutenberg-mobile#811

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@pinarol pinarol added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Apr 3, 2019
@pinarol pinarol self-assigned this Apr 3, 2019
@pinarol pinarol changed the title [Mobile]Fix upload progress not showing on the second upload issue [Mobile]Fix image upload progress not being displayed on the second time issue Apr 3, 2019
@pinarol pinarol changed the title [Mobile]Fix image upload progress not being displayed on the second time issue [Mobile]Fix image upload progress not being displayed on the second time Apr 3, 2019
@mzorz
Copy link
Contributor

mzorz commented Apr 3, 2019

Comparing to previous, new version will sometimes listen to upload events unnecessarily, but if I am not missing sth that's also the case when we have multiple image blocks uploading in parallel, we'll have some unrelated mediaUpload events coming in that case too. We trust the below check to ignore complications,

Sounds good to me! going to test shortly 👍

Copy link
Contributor

@mzorz mzorz left a comment

Choose a reason for hiding this comment

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

Good catch @pinarol !
Tested, LGTM :shipit:

@pinarol pinarol merged commit b2cf66e into master Apr 4, 2019
@pinarol pinarol deleted the rnmobile/fix-upload-progress branch April 4, 2019 08:19
@youknowriad youknowriad added this to the 5.5 (Gutenberg) milestone Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image block fails to show upload progress second time we upload image
3 participants