-
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
[$250] Android - Chat - User lands on previous attachment when sending image and opening preview #52415
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 and pasted it twice. This is a case with the same source, but I saw that it is handled elsewhere. So, I think my comment is outdated. Thanks. |
@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... |
@srikarparsi Bump on above. |
Sounds good, thanks |
📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@akinwale @greg-schroeder @srikarparsi @nkdengineer 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! |
Issue not reproducible during KI retests. (First week) |
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: @akinwaleThe text was updated successfully, but these errors were encountered: