-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Pay 7/30] [Dev] - [StrictMode] Attachments not loading and app crashes when click on loading preview from attachment #44566
Comments
Triggered auto assignment to @mallenexpensify ( |
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989 |
Can't remember the best practice for dev issues so checking on in #bug-zero |
ProposalPlease re-state the problem that we are trying to solve in this issue.Attachment is infinitely loading and crash when opens in DEV. What is the root cause of that problem?This happens because of the new strict mode. For the crash, it happens becuase of maximum update stack error. As we know, strict mode will cause the component to mount and unmounted twice. What happen is, the modal is open and close repeatedly and infinitely. The attachment carousel has an effect that calls App/src/components/Attachments/AttachmentCarousel/index.tsx Lines 89 to 92 in d489ba4
onNavigate will call this function to update the route.App/src/pages/home/report/ReportAttachments.tsx Lines 25 to 31 in d489ba4
But the modal component has a cleanup effect that will calls App/src/components/Modal/BaseModal.tsx Lines 113 to 123 in d489ba4
And App/src/pages/home/report/ReportAttachments.tsx Lines 41 to 45 in d489ba4
For the infinite loading issue, it comes from the react-native-web image headers patch that we have. The image header has 2 The first one is to cancel any ongoing request and remade a new one when the source is updated, and the others to cancel any ongoing request when unmounted. App/patches/react-native-web+0.19.12+003+image-header-support.patch Lines 78 to 99 in d489ba4
But because of the strict mode, the unmounted cleanup is called, which cancels the ongoing request. The 1st What changes do you think we should make in order to solve the problem?To fix the crash, we should replace App/src/pages/home/report/ReportAttachments.tsx Lines 41 to 45 in d489ba4
Why? I think in this case, doing a navigation isn't supposed to be done in a
If we want to keep using For the infinite loading issue, another reason the strict mode exist is to make sure we setup and cleanup an effect properly. In the image with headers case, it's a bit different. In a normal case, we would do something like this:
However, the deps of image with headers includes App/patches/react-native-web+0.19.12+003+image-header-support.patch Lines 22 to 24 in d489ba4
and only cancel and remade the request when the source content (uri and headers) is really updated. So, to fix this, I propose to clears the current request source when the component is unmounted.
The above code clears the current request with the initial request value, but I think it's better if the initial request value is null to make it simple. Then, we just need to adjust the code here to add null safety to the current request source and default it to an empty object.
Resetting it to null is similar to what the rn-web did with the image (without headers). If you see the 2nd link above, you will notice that the image (without headers) will cancel and remade the request whenever But, I'm not sure how should we approach this rn-web patch fix. The upstream PR for this patch hasn't been closed yet and currently is merged to the rn-web 0.20 preview PR. |
@mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov ( |
@alitoshmatov can you attempt reproduction? If you're able to reproduce , can you review @bernhardoj 's proposal above? (also.. I'm assuming this can be External, I'm not that familiar with dev environment-only issues. |
cc @Kicu cuz it involves |
@mallenexpensify, @alitoshmatov Huh... This is 4 days overdue. Who can take care of this? |
@alitoshmatov , 👀 above plz |
Sorry missed this couple of times. I was low on bandwidth this week, so I would unassign myself and ask for another C+ on slack. cc: @mallenexpensify |
I'll take this over from @alitoshmatov, based on Slack thread. I'll try to reproduce |
Issue not reproducible during KI retests. (First week) |
@mallenexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Sorry I kinda forgot about this and I'm late to the party, but I think the RCA part is good work. I don't want to speak for the Modals fix since Im not familiar with modals code in this project. The fix regarding cancelling and resetting request sound legit 👍 |
@bernhardoj You were (silently) assigned, I think you have the 🟢 to open the PR.
Yep, because melvin removed the |
Yes, indeed! Looks like our automations didn't trigger maybe. Oops! 🟢 to @bernhardoj |
Thanks for the bump! Working on the PR... |
PR is ready cc: @ikevin127 |
|
Contributor: @bernhardoj owed $250 via Upwork @ikevin127 can you please accept the job and reply here once you have? @ikevin127 plz complete the BZ checklist below. thx BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@ikevin127 paid, post above updated to reflect payment. |
Regression Test Proposal
Do we agree 👍 or 👎. |
Requested in ND. |
$250 approved for @bernhardoj |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number:
Reproducible in staging?: need reproduction
Reproducible in production?: need reproduction
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
Expensify/Expensify Issue URL:
Issue reported by: @ishpaul777
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1719508144288849
Action Performed:
Action Performed:
Expected Result:
Actual Result: Image infinitely loading in preview and app crashes on clicking preview.
Expected Result:
Image not infinitely loading in preview and app not crash on clicking preview.
Actual Result:
Image infinitely loading in preview and app crashes on clicking preview.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Screen.Recording.2024-06-26.at.10.17.30.PM.mov
View all open jobs on GitHub
Issue Owner
Current Issue Owner: @mallenexpensifyThe text was updated successfully, but these errors were encountered: