Open lanitochka17 opened 1 year ago
Triggered auto assignment to @garrettmknight (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)When image attachment is opened several times in Native apps, sometimes the loading icon is shown forever and the image preview does not load.
In ImageView (index.native.js)
, we have callback function logics to set
isLoading: true
in onLoadStart
callback; and
isLoading: false
in onLoad
callback;
That works well when it is the first time the image is being opened, onLoadStart
get called first when loading start, and onLoad
get called later when loading ends.
However, when an image is being opened more than once, it is already cached, so technically the image does not need to be loaded anymore, onLoadStart
and onLoad
callbacks actually fires at the same time in these cases.
Sometimes onLoadStart
fires first, and we have no problem.
Other times, onLoad
fires first, followed by onLoadStart
, in this scenario, isLoading
state is set to false and then true, thus the loading icon is shown forever instead of image preview.
We actually do not need to configure onLoadStart
callback, as its purpose is to resetImageZoom
whenever the source image URL changes.
That is already handled via componentDidUpdate
component lifecycle function, which is already calling resetImageZoom
whenever the URL changes.
To resolve the issue, we should unset onLoadStart
by removing this line
https://github.com/Expensify/App/blob/2f750ad9fad7be1b1e4095a778385ea5a2f06f3b/src/components/ImageView/index.native.js#L225
If the indeterministic firing sequence of onLoadStart
and onLoad
when image does not requires loading (when already cached) is considered as a bug in upstream library react-native-fast-image
, then we can also choose to submit a PR fix upstream.
might be same root cause https://github.com/Expensify/App/issues/22920
@gadhiyamanan agreed, I think this looks like the same root cause. Let's put this on hold and leave this open until this PR is deployed. I'll retest and see if that fixed it.
Still holding
Still holding
Still holding
Still holding
Still holding
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
Still holding on https://github.com/Expensify/App/pull/18997
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
The image preview is shown every time
Actual Result:
Infinite loading after opening the image preview a few times. The same behavior when opening images from old chats
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.49.0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://github.com/Expensify/App/assets/78819774/0fe353c5-d2d0-4577-8a92-a5fce6b361bd
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub