-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix resizes on image upload #8928
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
Sorry, @allroundexperts missed this one. |
@Santhosh-Sellavel Updated. |
@allroundexperts Attachment.get.hidden.for.a.second.movcc: @chiragsalian |
@Santhosh-Sellavel Is this issue intermittent? Or does it always happen? |
Screen.Recording.2022-05-21.at.3.43.41.AM.mov@chiragsalian This is expected behavior right? |
Hmm so it looks like once we attach an image,
@allroundexperts, do we need the loader gif? Is it possible to remove it. The reason i suggest this is because with our offline first design changes if the user is offline we'll still show the attachment thumbail as per step 1 and have a different language to show a comment hasn't been saved in the server. So i think showing the loader in the middle doesn't have much value here. Thoughts? |
What should we replace it with?
…On Mon, 23 May 2022 at 11:10 PM, Chirag Chandrakant Salian < ***@***.***> wrote:
Hmm so it looks like once we attach an image,
1. First the image shows up with its own thumbnail with correct
dimensions.
2. Then once Report_AddComment finishes then the loader gif shows up.
3. Then the loader hides and the same thumbnail image from step 1
shows up.
@allroundexperts <https://github.com/allroundexperts>, do we need the
loader gif? Is it possible to remove it.
[image: image]
<https://user-images.githubusercontent.com/14356145/169880937-71529f0d-8d52-452b-a34d-548967a7a86e.png>
The reason i suggest this is because with our offline first design changes
if the user is offline we'll still show the attachment thumbail as per step
1 and have a different language to show a comment hasn't been saved in the
server. So i think showing the loader in the middle doesn't have much value
here. Thoughts?
—
Reply to this email directly, view it on GitHub
<#8928 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHFJUUHMXGEVS6CHJPXMYXLVLPCZZANCNFSM5VS4JZIQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Can we not keep it as the attachment thumbnail before the api request was completed? From my comment above the image thumbnail from step 1 and 3 looks identical so i was wondering if we could just not show the loader gif? I was wondering If we could update the code so that the loader from step 2 would not be shown so that the attachment upload looks smoother. I haven't looked at the code closely but i imagine if the response dimensions and image is the same as what we already had then don't show the loader. Thoughts? |
Okay, so let's take your step you mentioned in the earlier comment. Is it possible to to not show the loader while downloading the image when we already have a thumbnail with the proper dimensions? I'm pretty much asking if we can come up with a plan to not show the loader in the middle since it feels unnecessary and weird when the user is sees a proper thumbnail, then sees a loader gif to again see the proper thumbnail from earlier. Or do you feel there is a time when the user attaches an image that the loader is necessary? If so can you explain why? I do think when there is no thumbnail the loader should still be shown, like when we switch to a chat and you are downloading messages and images then i think it makes sense to have. Also if its difficult to change i don't mind keeping it too. Was just wondering if this would be a nice user experience improvement to remove the loader gif when image thumbnail and dimensions are already known. |
@chiragsalian If you look at the code, you'll see that when the user uploads the image from his local machine, at that point, we create a offline db record and save it in the local storage. That db record contains all the fields as a remote db record would except the image url will be the one that points to the local blob url. As soon as the API request is made, the record that was saved locally on users storage gets replaced with the remote record that has the image url pointing to your storage server. The approach that you're suggesting would require: This all won't still work for the other users in the chat room. We'll still need to show them the loader because they only have a single source to get the image from ie your server. Doing this change for just a single user (other users would still see loader) is not worth the time in my opinion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good & Tests well!
cc: @chiragsalian
PR Reviewer Checklist
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested some minor changes but the rest LGTM and works well.
Friendly bump @allroundexperts to update the PR based on my review comments. |
Handled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for the changes.
PR Reviewer Checklist
- I verified the correct issue is linked in the
### Fixed Issues
section above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Tests
section - I verified the steps for Staging and/or Production testing are in the
QA steps
section - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I verified tests pass on all platforms & I tested again on:
- iOS / native
- Android / native
- iOS / Safari
- Android / Chrome
- MacOS / Chrome
- MacOS / Desktop
- I verified there are no console errors (if there’s a console error not related to the PR, report it or open an issue for it to be fixed)
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
toggleReport
and notonIconClick
). - I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained “why” the code was doing something instead of only explaining “what” the code was doing.
- I verified any copy / text shown in the product was added in all
src/languages/*
files - I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team on the original GH to get the correct copy.
- I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named “index.js”. All platform-specific files are named for the platform the code supports as outlined in the README.
- I verified the JSDocs style guidelines (in
STYLE.md
) were followed
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
- If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately and each prop has a
/** comment above it */
- Any functional components have the
displayName
property - The file is named correctly
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- For Class Components, any internal methods passed to components event handlers are bound to
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor) - Any internal methods bound to
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
) - All JSX used for rendering exists in the render method
- The component has the minimum amount of code necessary for its purpose and it is broken down into smaller components in order to separate concerns and functions
- If a new CSS style is added I verified that:
- A similar style doesn’t already exist
- The style can’t be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avatar
is modified, I verified thatAvatar
is working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
Merging since santhosh approved earlier. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @chiragsalian in version: 1.1.72-0 🚀
|
@allroundexperts FYI, this got reverted to fix this deploy blocker: #9334 Without taking additional time on a time sensitive issue, we could not narrow down which part of this PR actually caused the bug. It is probably a good idea to "retry" this PR, but make sure we test for the bug from the deploy blocker as the changes are being made so we can pinpoint the issue and fix it. |
🚀 Deployed to production by @yuwenmemon in version: 1.1.73-2 🚀
|
const imageWidth = htmlAttribs['data-expensify-width'] ? parseInt(htmlAttribs['data-expensify-width'], 10) : undefined; | ||
const imageHeight = htmlAttribs['data-expensify-height'] ? parseInt(htmlAttribs['data-expensify-height'], 10) : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if data-expensify-width
is set to "0"
, it breaks PDF rendering. #33626
Details
Fixed Issues
$ #8590
Tests
+
icon.PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followed/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
+
icon.Screenshots
Web
167023275-f91c0d23-80bb-4415-9023-d07677fe6544.mp4
Mobile Web
simulator-screen-recording-iphone-13-2022-05-12-at-233355_flQfDWOD.mp4
Desktop
screen-recording-2022-05-12-at-113641-pm_c8BPFcNJ.mp4
iOS
simulator-screen-recording-iphone-13-2022-05-12-at-214353_2o7S3HVD.mp4
Android
screen-recording-2022-05-12-at-112758-pm_odUBRRbl.mp4