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

6326: fix bug reported at #6518 #6535

Merged
merged 5 commits into from
Dec 6, 2021

Conversation

railway17
Copy link
Contributor

Details

Regress bugs that are displayed when testing with very long or wide images

Fixed Issues

$ Original Issue
$ Regression Issue

Tests

  1. Prepare a very long image and send it to another.
  2. Follow on the Chat - Magnifying glass displayed anywhere on the modal page for small images #6326 test case.
  3. Prepare a very wide image and send it to another.
  4. Follow on the Chat - Magnifying glass displayed anywhere on the modal page for small images #6326 test case.

QA Steps

  1. Prepare a very long image and send it to another.
  2. Follow on the Chat - Magnifying glass displayed anywhere on the modal page for small images #6326 test case.
  3. Prepare a very wide image and send it to another.
  4. Follow on the Chat - Magnifying glass displayed anywhere on the modal page for small images #6326 test case.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Web Regression Video

Desktop

Desktop Regression Video

@railway17 railway17 requested a review from a team as a code owner November 30, 2021 13:17
@MelvinBot MelvinBot requested review from deetergp and removed request for a team November 30, 2021 13:17
Copy link
Contributor

@deetergp deetergp left a comment

Choose a reason for hiding this comment

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

Code looks good, but I had a couple comments regarding comments.

@@ -84,8 +86,13 @@ class ImageView extends PureComponent {
imgRight = imgLeft + (fitRate * width);
}

//In case image loading is delayed than onLayout callback of the root View caused internet speed
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment isn't exactly clear. Is it still relevant/needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, my internet speed is not good sometimes. And I noticed that it has some issue because we would not load image correctly.
If you don't need this, I will remove.

if (isZoomed) {
if (zoomScale > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you please note what's going on in the UI in each of these cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the comments for each styling logic.
And noticed that my styling was not correct in the previous commit.
So, fixed it too. (when isZoom === false && zoomScale < 1)
Please review and let me know if something is still not clear.
Thank you

Copy link
Contributor

Choose a reason for hiding this comment

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

That's perfect. Thanks!

deetergp
deetergp previously approved these changes Dec 1, 2021
@deetergp
Copy link
Contributor

deetergp commented Dec 1, 2021

Approved, but it looks like you've got a couple merge conflicts to resolve.

@railway17
Copy link
Contributor Author

@railway17 railway17 closed this Dec 2, 2021
@railway17 railway17 deleted the han-fix-magnifying-glass branch December 2, 2021 00:47
@railway17
Copy link
Contributor Author

Approved, but it looks like you've got a couple merge conflicts to resolve.

Oh.. sorry
I had mistake while checking this page.
Clicked the close pull request button unexpectedely.

@railway17
Copy link
Contributor Author

Approved, but it looks like you've got a couple merge conflicts to resolve.

Hi, @deetergp
Do you want me to merge this PR to main by resolving conflicts myself?

# Conflicts:
#	src/components/ImageView/index.js
#	src/styles/styles.js
@railway17
Copy link
Contributor Author

Hi, @deetergp
Because there was a problem resolving conflict in GitHub, I did it locally. (I noticed that my style code was moved to StyleUtil.js).
Please review it and let me know if you have any other problem
Thank you

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

Could you please follow the template for the PR?

$ Original Issue
$ Regression Issue

Revert these to how they should be.

this.setState({
imgWidth: width, imgHeight: height, imageLeft: imgLeft, imageTop: imgTop, imageRight: imgRight, imageBottom: imgBottom,
});
// In case image loading is delayed than onLayout callback of the root View caused internet speed.
Copy link
Member

Choose a reason for hiding this comment

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

I didn't really understand what this comment is about?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For regression, there is new issue that is open.
Because I didn't know which issue number should be written, so I made it.
Which issue number should be written?
Original one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this comment, I noticed that image loading is delayed because of internet speed.
In this case, image size is not decided even though the container (modal) is open.
Because of this reason, zoomScale is also not decided.
To avoid this problem, I wrote the code and comment like above.

Copy link
Member

@parasharrajat parasharrajat Dec 2, 2021

Choose a reason for hiding this comment

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

onLayout callback of the root View caused internet speed.

this is not making sense to me. Could you please update it?

Please mention both issue URLs in the description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It means
1: You don't need such exception handling? Need to remove that code?
2. Should not write as Original issue, Regression issue?
Instead of it, should write urls directly like below?
https://github.com/Expensify/App/issues/6326, https://github.com/Expensify/App/issues/6518

Copy link
Contributor Author

@railway17 railway17 Dec 3, 2021

Choose a reason for hiding this comment

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

Hi, @parasharrajat
Could you please let me know what you expect exactly?

Copy link
Member

Choose a reason for hiding this comment

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

I will let others review it. I don't really know this part of code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you want, I can remove that code shortly.
But I added that code because I noticed the issue in my side.
Please let me know whenever you have any feedback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @parasharrajat , @deetergp
How are you doing?
Any feedback from other reviewers?
Please kindly let me know so that we can proceed.
Thank you

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried hard to understand what you were trying to communicate with this comment, but it doesn't make sense to me. It sounds like there's some race condition at play here? If you can explain what you mean in a different way, that would be great. Otherwise, please just remove this comment.

@parasharrajat
Copy link
Member

I am not familiar with this part of code thus I would not be able to properly review it. I am also not assigned to this issue. Please continue without my review.

I would recommend to get more eyes on this PR as there could be more regressions.

@railway17
Copy link
Contributor Author

I am not familiar with this part of code thus I would not be able to properly review it. I am also not assigned to this issue. Please continue without my review.

I would recommend to get more eyes on this PR as there could be more regressions.

@parasharrajat
Thank you for your quick reply.

Approved, but it looks like you've got a couple merge conflicts to resolve.

@deetergp
Could you approve this PR again?
You have already approved this PR but it needs another approval while I merge with main in my local.
I think it is caused by my bad activity.
Please check my merging (I merged correctly but you can double-check) and approve so that we can proceed.
Thank you

@railway17
Copy link
Contributor Author

@roryabraham
What means your assignment?
Did something go wrong?

@roryabraham roryabraham self-requested a review December 6, 2021 17:07
@roryabraham
Copy link
Contributor

Hi @railway17. I'm going to review this – this is time-sensitive so let's work together to get this merged ASAP.

@railway17
Copy link
Contributor Author

Hi @railway17. I'm going to review this – this is time-sensitive so let's work together to get this merged ASAP.

Ok, here is 1:00am now, but I will try to work with you together.
Let's start now.

Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

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

Also, what if the window resizes? I think maybe we need to handle this by:

  1. Saving the image height as a class field before calling setImageRegion
  2. Calling setImageRegion again in componentDidUpdate if the window dimensions changed.

const newZoomScale = Math.min(this.state.containerWidth / width, this.state.containerHeight / height);
this.setState(prevState => ({
imgWidth: width,
zoomScale: prevState.zoomScale === 0 ? newZoomScale : prevState.zoomScale,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use the newZoomScale in all cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I was going to set zoomScale in the onLayout event of the parent view.
But while testing in my local, I noticed that it is sometimes 0 because image loading is slower than view loading.
So, reset with newZoomScale here.

this.setState({
imgWidth: width, imgHeight: height, imageLeft: imgLeft, imageTop: imgTop, imageRight: imgRight, imageBottom: imgBottom,
});
// In case image loading is delayed than onLayout callback of the root View caused internet speed.
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried hard to understand what you were trying to communicate with this comment, but it doesn't make sense to me. It sounds like there's some race condition at play here? If you can explain what you mean in a different way, that would be great. Otherwise, please just remove this comment.

@roryabraham
Copy link
Contributor

@railway17 It's okay – what I'm going to do instead is revert your original PR and that way we can take the time we need to re-implement it without causing a regression.

@railway17
Copy link
Contributor Author

@railway17 It's okay – what I'm going to do instead is revert your original PR and that way we can take the time we need to re-implement it without causing a regression.

I removed the comment from that code and pushed it.
It is under checking now.

@roryabraham
Copy link
Contributor

I removed the comment from that code and pushed it.
It is under checking now.

Okay, I had a couple more comments in my last review

@railway17
Copy link
Contributor Author

  1. setImageRegion

2. setImageRegion
Actually, this issue requirement was fixing cursor icon issue while zoomin or zoomout for small thumbnails.
So, I didn't consider about window resize.

Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

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

Okay, I'm going to approve and CP this to unblock the deploy, but will follow up with a small PR of my own to address my comments.

@roryabraham
Copy link
Contributor

CP'ing to unblock deploys.

@roryabraham roryabraham merged commit d445fda into Expensify:main Dec 6, 2021
@botify
Copy link

botify commented Dec 6, 2021

@roryabraham looks like this was merged without passing tests. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2021

⚠️ ⚠️ Heads up! This pull request has the CP Staging label. ⚠️ ⚠️
Merging it will cause it to be immediately deployed to staging, even if the open StagingDeployCash deploy checklist is locked.

github-actions bot pushed a commit that referenced this pull request Dec 6, 2021
@roryabraham
Copy link
Contributor

Not an emergency, just CP'ing to speed up deploys. Only change since last successful E2E test was the removal of a comment.

@OSBotify
Copy link
Contributor

OSBotify commented Dec 7, 2021

🚀 Deployed to staging by @roryabraham in version: 1.1.17-8 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Dec 8, 2021

🚀 Deployed to production by @roryabraham in version: 1.1.18-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@parasharrajat
Copy link
Member

parasharrajat commented Dec 15, 2021

We have found another regression from this PR. @railway17

cc: @roryabraham

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants