Skip to content
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

[ON HOLD — #23546][$1000] Chat - Several images at once are skipped when switching attachments with arrows #22318

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 6, 2023 · 120 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 6, 2023

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:

  1. Open staging.new.expensify.com with Safari
  2. Login in any account
  3. Go to any chat with multiple attachments
  4. Select any attachment
  5. Switch attachments with on-screen arrows

Expected Result:

Only the next attachment is loaded by clicking on the on-screen arrow

Actual Result:

Several images at once are skipped when switching attachments with on-screen arrows

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.37.2

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

Bug6117796_Safari-Attachments-Preview-Skip.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f9c0565b91f7e6d4
  • Upwork Job ID: 1677033938685763584
  • Last Price Increase: 2023-08-03
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@CortneyOfstad
Copy link
Contributor

Was able to recreate, so going to get eyes on this 👍

@CortneyOfstad CortneyOfstad added the External Added to denote the issue can be worked on by a contributor label Jul 6, 2023
@melvin-bot melvin-bot bot changed the title Chat - Several images at once are skipped when switching attachments with arrows [$1000] Chat - Several images at once are skipped when switching attachments with arrows Jul 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01f9c0565b91f7e6d4

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

Current assignee @CortneyOfstad is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External)

@univalchemist
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.

Chat - Several images at once are skipped when switching attachments with arrows

What is the root cause of that problem?

The prop maxToRenderPerBatch of FlastList cause this issue. As mentioned in official React Native documentation, this prop maxToRenderPerBatch is a VicualizedList prop that can be passed through. The current modal attachment list is horizontal, so don't need this one.

What changes do you think we should make in order to solve the problem?

Removing prop maxToRenderPerBatch is a solution here .

What alternative solutions did you explore? (Optional)

N/A

Here is a video link after fixed:
https://www.loom.com/share/bc5bb3fd5ec54a7daa52b405971688f1

@uafrontender
Copy link
Contributor

@lanitochka17 maybe this issue is related to this one #21177

@univalchemist as I understand Removing prop maxToRenderPerBatch is setting it to default value. And after this there is that default Safari bug anyway. You can find it in your Loom video too. When you click on any image, 1st one displayed is image with cat (last image in your attachments) and then loaded correct image.

@univalchemist
Copy link

@mkarkachov , removing prop maxToRenderPerBatch is not setting it to the default value. It does not have any default value and removing it means undefined. Yes, this is just issue on Safari and it is related with this prop. Also notice that this prop affects in only the virtual list.

@melvin-bot melvin-bot bot added the Overdue label Jul 10, 2023
@CortneyOfstad
Copy link
Contributor

Not overdue 👍

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2023
@kidroca
Copy link
Contributor

kidroca commented Jul 12, 2023

The maxToRenderPerBatch parameter is not added by accident; the chosen value plays a crucial role. Despite the fact that we only see one item at a time, two additional items are rendered on each side (outside of view). This effectively preloads the subsequent and previous attachments, preparing the content that the user is likely to interact with next.

The list's orientation, horizontal in this case, does not provide a valid reason for eliminating this property. The maxToRenderPerBatch parameter is a vital part of virtualization, and it operates irrespective of the type of the list.

Furthermore, this property has a default value of 10 (see maxToRenderPerBatchOrDefault). This implies that removing the property would not solve the issue but merely displace it. It might also degrade loading as we'll start loading 10 images shortly after the carousel is opened

Erasing the property or augmenting the value of maxToRenderPerBatch only masks the issue. This is because the problem would then only surface for conversations encompassing more than 10 attachments.

@melvin-bot melvin-bot bot added the Overdue label Jul 12, 2023
@CortneyOfstad
Copy link
Contributor

Not overdue

@melvin-bot melvin-bot bot removed the Overdue label Jul 12, 2023
@univalchemist
Copy link

The maxToRenderPerBatch parameter is not added by accident; the chosen value plays a crucial role. Despite the fact that we only see one item at a time, two additional items are rendered on each side (outside of view). This effectively preloads the subsequent and previous attachments, preparing the content that the user is likely to interact with next.

The list's orientation, horizontal in this case, does not provide a valid reason for eliminating this property. The maxToRenderPerBatch parameter is a vital part of virtualization, and it operates irrespective of the type of the list.

Furthermore, this property has a default value of 10 (see maxToRenderPerBatchOrDefault). This implies that removing the property would not solve the issue but merely displace it. It might also degrade loading as we'll start loading 10 images shortly after the carousel is opened

Erasing the property or augmenting the value of maxToRenderPerBatch only masks the issue. This is because the problem would then only surface for conversations encompassing more than 10 attachments.

Ok, let's see who suggests another solution then!

@AshenI99
Copy link

AshenI99 commented Jul 13, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Chat - Several images at once are skipped when switching attachments with arrows

What is the root cause of that problem?

The pagingEnabled property in FlatList caused the error. According to the react-native docs(Here), when pagingEnabled property is true, the scroll view stops on multiples of the scroll view's size when scrolling. So, it seems like it is automatically scrolling when the next set of images are loaded.

However, pagingEnabled property is necessary for mobile devices to use the paging behavior when swiping through images. So, we cannot completely remove that.

What changes do you think we should make in order to solve the problem?

Setting the pagingEnabled property to false only for non-touch screens will fix the issue. (Here)

pagingEnabled={this.canUseTouchScreen}

What alternative solutions did you explore? (Optional)

None

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

📣 @AshenI99! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@CortneyOfstad
Copy link
Contributor

@kidroca any updates? Thanks!

@kidroca
Copy link
Contributor

kidroca commented Feb 7, 2024

Currently focused on other urgent tasks, so I haven't made any progress yet. I plan to come back to this ticket by the end of the week. Thanks for your patience.

@CortneyOfstad
Copy link
Contributor

@kidroca any updates?

Also, @sourcecodedeveloper, we have someone assigned already, but thank you for reaching out!

@kidroca
Copy link
Contributor

kidroca commented Feb 22, 2024

Hi team,

I wanted to provide a quick status update on the ticket regarding the carousel bug we've been tackling. Despite implementing the ScrollView strategy I previously proposed, the issue persisted, leading me to conduct a deeper investigation. It became clear that the problem wasn't specific to the use of ScrollView or FlatList; rather, it was rooted in how Safari on iOS manages snap alignment when cycling through attachments. I've shared a detailed analysis on a related ticket, given its relevance to the discussion there.

Ticket History Summary:

The core of the issue has been identified as CSS snap alignment of scroll items, as elaborated in my recent analysis

I'm currently exploring alternatives and keeping an eye on proposals in related tickets. I'll ensure to keep everyone updated with any new developments or insights.

Thank you for your patience and collaboration as we work through this complex issue.

@CortneyOfstad
Copy link
Contributor

Thank you @kidroca for the detailed explanation! This is incredibly thorough, and if there is anything that we can do to help in support, do not hesitate to ask! Within BZ, I will also keep an eye out for anything related that could help 👍

@kidroca
Copy link
Contributor

kidroca commented Mar 13, 2024

Hi team,

I'm reaching out to share an important update on the carousel bug across several related tickets. I realized I might not have communicated this breakthrough in all relevant discussions, so I wanted to ensure everyone is on the same page.

Exciting news: I've found and proposed a straightforward solution that effectively tackles the attachment carousel issue and simultaneously addresses the related challenges we encountered. For a detailed account of the steps taken and the rationale behind them, please refer to my comprehensive summary here: Issue Summary and Solution, which is currently pending a C+ review.

The essence of the solution lies in our ability to manually manage scroll and panning interactions, thereby circumventing the pitfalls associated with scroll snap alignment in virtual lists. This approach has shown promising results in our initial tests, offering a solid fix for the issues we've been diligently working to resolve.

Thank you for your continued patience and collaborative spirit as we navigate these challenges together. I'll keep you all updated with any further developments.

@CortneyOfstad CortneyOfstad changed the title [$1000] Chat - Several images at once are skipped when switching attachments with arrows [ON HOLD — #23546][$1000] Chat - Several images at once are skipped when switching attachments with arrows Mar 13, 2024
@CortneyOfstad
Copy link
Contributor

Thank you so much @kidroca!

@CortneyOfstad
Copy link
Contributor

Bumped the on-hold GH here. Will follow-up as soon as they respond 👍

@CortneyOfstad
Copy link
Contributor

Update was posted here

@CortneyOfstad
Copy link
Contributor

Draft PR was created here! 🎉

@CortneyOfstad
Copy link
Contributor

PR is still in draft but there is a stale PR in the on-hold GH, so reaching out to Scott (engineer on the main GH) to help move this along here

kidroca added a commit to kidroca/Expensify.cash that referenced this issue Apr 22, 2024
- Fixed an issue with carousel scrolling in the AttachmentCarousel component
- Implemented a new pan gesture for smoother scrolling experience
- Adjusted layout calculations for optimal rendering of attachments

Related to:
- Expensify#23546
- Expensify#39833
- Expensify#22318
- Expensify#21177
- Expensify#31166
@CortneyOfstad
Copy link
Contributor

Just bumped the on-hold issue, as the PR is ready for review!

@CortneyOfstad
Copy link
Contributor

Bumped here

@CortneyOfstad
Copy link
Contributor

On the on-hold GH, it was indicated that the PR would be merged early next week — will continue to keep an eye on that 👍

@CortneyOfstad
Copy link
Contributor

Bumped the on-hold GH to see if we're still on pace for this week — will follow up as soon as I hear back 👍

@CortneyOfstad
Copy link
Contributor

Merge freeze in place, so having to wait a bit for the on-hold issue

@CortneyOfstad
Copy link
Contributor

PR comment here indicates potential merge today 🎉 Bumped the main GH and will continue to monitor

@CortneyOfstad
Copy link
Contributor

We're in a merge freeze right now, so this will be delayed a bit 👍

@CortneyOfstad
Copy link
Contributor

Merge freeze ends today! 🤞

@CortneyOfstad
Copy link
Contributor

Was deployed to production 4 days ago 😍

@CortneyOfstad CortneyOfstad added Daily KSv2 and removed Weekly KSv2 labels Jun 3, 2024
@CortneyOfstad
Copy link
Contributor

Set to be out of the 7-day window tomorrow 🥳

@CortneyOfstad
Copy link
Contributor

This can be closed as the on-hold issue has been resolved/completed! Wahooo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review
Projects
Development

No branches or pull requests