-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[HOLD for payment 2024-12-20] [$250] Android - Chat - User lands on previous attachment when sending image and opening preview #52415
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
Comments
Triggered auto assignment to @greg-schroeder ( |
Job added to Upwork: https://www.upwork.com/jobs/~021856559033364524387 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.When sending an image to a chat that already contains an image or video attachment, and opening the preview quickly when it was just sent, the user lands on a previous attachment and not in the one that was selected What is the root cause of that problem?When we add an attachment and click to open attachment quickly, the
This causes the key of the item to be changed and then App/src/components/Attachments/AttachmentCarousel/Pager/index.tsx Lines 89 to 94 in c24d217
What changes do you think we should make in order to solve the problem?Since
or
App/src/components/Attachments/AttachmentCarousel/Pager/index.tsx Lines 89 to 94 in c24d217
What alternative solutions did you explore? (Optional)ResultScreen.Recording.2024-11-13.at.14.35.58.mov |
ProposalPlease re-state the problem that we are trying to solve in this issue.User lands on previous attachment when sending image and opening preview What is the root cause of that problem?We send the attachment and open it immediately, so the source will initially be a local path. After the upload is finished, the source changes to the App/src/components/Attachments/AttachmentCarousel/index.tsx Lines 182 to 186 in 5ecd45e
After the list re-renders, the activePage is lost and reset once the re-render is complete. As a result, we will see the attachment from the previous ticket What changes do you think we should make in order to solve the problem?We can't change the source used as the key because it's meant to prevent unnecessary re-renders when we have multiple sources with the same path. To resolve this issue, we should store the
// src/components/Attachments/AttachmentCarousel/index.native.tsx#L31
+ const [keys, setKeys] = useState([]);
+ const [activePageBeforeChangedKey, setActivePageBeforeChangedKey] = useState();
// src/components/Attachments/AttachmentCarousel/index.native.tsx#L111
+ const extractItemKey = useCallback((item: Attachment, index: number) => {
+ return typeof item.source === 'string' || typeof item.source === 'number' ? `source-${item.source}` : `reportActionID-${item.reportActionID}` ?? `index-${index}`;
+ }, []);
+ useEffect(() => {
+ const currentKeys = attachments.map((item, index) => extractItemKey(item, index));
+ const isIncludedLocalFile = attachments.some((item) => FileUtils.isLocalFile(item.source));
+ if (JSON.stringify(currentKeys) !== JSON.stringify(keys) && isIncludedLocalFile) {
+ console.log('Keys have changed');
+ setKeys(currentKeys);
+ setActivePageBeforeChangedKey(page);
+ }
+ }, [activePageBeforeChangedKey, attachments, extractItemKey, keys, page]);
+ useEffect(() => {
+ if (page === activePageBeforeChangedKey || activePageBeforeChangedKey === undefined) {
+ return;
+ }
+ setPage(activePageBeforeChangedKey);
+ if (activePageBeforeChangedKey) {
+ pagerRef.current?.setPage(activePageBeforeChangedKey);
+ }
+ setActivePageBeforeChangedKey(undefined);
+ }, [activePageBeforeChangedKey, page]); Note: We can still apply this logic if the web platform is also affected Test branchPOCScreen.Recording.2024-11-14.at.00.36.13.mp4 |
Proposal review next up! |
We can move forward with @nkdengineer's proposal here. 🎀👀🎀 C+ reviewed. |
Triggered auto assignment to @srikarparsi, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@akinwale Can you take a look at my proposal? If we don't use |
@akinwale, @greg-schroeder, @srikarparsi Huh... This is 4 days overdue. Who can take care of this? |
The source can not be the same and using a stable key doesn't cause any problem. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@akinwale I tested the case |
@srikarparsi We have no concerns now. We're good to move this forward. |
@akinwale, @greg-schroeder, @srikarparsi Eep! 4 days overdue now. Issues have feelings too... |
Issue not reproducible during KI retests. (First week) |
PR in review, comments as of 6 hours ago |
Work on linked PR continues |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.75-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-12-20. 🎊 For reference, here are some details about the assignees on this issue:
|
@akinwale @greg-schroeder @akinwale The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
@akinwale just needs to work through the checklist and then we'll be good to go for 12/20! |
BugZero Checklist:
Bug classificationSource of bug:
Where bug was reported:
Who reported the bug:
Regression Test ProposalTest:
Do we agree 👍 or 👎? |
@akinwale, @greg-schroeder, @srikarparsi, @nkdengineer Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Waiting on summary to approve New Expensify payment. |
@akinwale, @greg-schroeder, @srikarparsi, @nkdengineer Eep! 4 days overdue now. Issues have feelings too... |
@akinwale, @greg-schroeder, @srikarparsi, @nkdengineer 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
@akinwale, @greg-schroeder, @srikarparsi, @nkdengineer 10 days overdue. I'm getting more depressed than Marvin. |
Apologies for the delay on this over the holiday. Processing |
Payment summary: Contributor: @nkdengineer - $250 - Upwork Regression test filed. Good to go @JmillsExpensify |
$250 approved for @akinwale |
Uh oh!
There was an error while loading. Please reload this page.
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.60-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5204055&group_by=cases:section_id&group_order=asc&group_id=292107
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Preview of the just sent image should load correctly and the user should remain on it when opened
Actual Result:
When sending an image to a chat that already contains an image or video attachment, and opening the preview quickly when it was just sent, the user lands on a previous attachment and not in the one that was selected
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6662715_1731428003671.Prev_Attachment.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @greg-schroederThe text was updated successfully, but these errors were encountered: