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

[HOLD for payment 2024-06-06] [$2000] Wrong Image opens on HT Report in Safari #23546

Closed
2 of 6 tasks
kavimuru opened this issue Jul 25, 2023 · 203 comments
Closed
2 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Jul 25, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

1.Go to PROD.
2. Join the following channel https://new.expensify.com/r/8292963527436014
3. Scroll up and open shared images by users
4. After scrolling a little up again open some other image
5. Wrong image is displayed

Expected Result:

Correct image should be displayed

Actual Result:

Wrong image is displayed

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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:
Reproducible in staging?: needs reproduction
Reproducible in production?: needs 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
Notes/Photos/Videos: Any additional supporting documentation

wrong-image-ht.mov

Expensify/Expensify Issue URL:
Issue reported by: @Talha345
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690065844572829

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012f0ed142cb12018c
  • Upwork Job ID: 1685003651569020928
  • Last Price Increase: 2023-09-11
  • Automatic offers:
    • Talha345 | Reporter | 26772303
Issue OwnerCurrent Issue Owner: @CortneyOfstad
@kavimuru kavimuru added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 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

@melvin-bot melvin-bot bot added the Overdue label Jul 27, 2023
@michaelhaxhiu michaelhaxhiu added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Jul 28, 2023
@melvin-bot melvin-bot bot changed the title Wrong Image opens on HT Report in Safari [$1000] Wrong Image opens on HT Report in Safari Jul 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

Job added to Upwork: https://www.upwork.com/jobs/~012f0ed142cb12018c

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

melvin-bot bot commented Jul 28, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

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

@michaelhaxhiu
Copy link
Contributor

Reproduced easily on Safari for me 👍

575Lao4lJu

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 28, 2023
@michaelhaxhiu
Copy link
Contributor

Not overdue, fielding proposals still

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2023
@mikesmnx
Copy link

mikesmnx commented Jul 31, 2023

Proposal

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

A wrong image (or a series of wrong images) is displayed if a user clicks on one of the attachments in the chat. I was able to reproduce this issue in both Safari and Chrome.

What is the root cause of that problem?

The FlatList settings that are being used in the AttachmentCarousel Component. The combination of these settings leads to the updatePage function being called with wrong parameters on carousel initialization and first scroll (via onViewableItemsChanged={updatePage}).

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

I changed viewabilityConfig, initialNumToRender, windowSize, maxToRenderPerBatch, bounces and pagingEnabled properties. The pagingEnabled and minimumViewTime parameters are mandatory, while the others are optional.

The carousel now works properly in Safari, on both desktop and mobile.

Explanation:

  • minimumViewTime=300 (was none)
    Minimum amount of time (in milliseconds) that an item must be physically viewable before the viewability callback will be fired

Adding this to decrease the likelihood of triggering the viewability callback, which would lead to an updatePage call.

  • initialNumToRender=1 (was 3)
    The initial amount of items to render

Since we're displaying only one attachment at a time, there's no need for a larger value.

  • windowSize=3 (was 5)
    The number passed here is a measurement unit where 1 is equivalent to your viewport height. The default value is 21 (10 viewports above, 10 below, and one in between)

Since we're only displaying the previous or next attachment, there's no need for a larger window.

  • maxToRenderPerBatch=1 (was 3)
    This controls the amount of items rendered per batch, which is the next chunk of items rendered on every scroll

Since we're displaying only one attachment at a time, there's no need for a larger value.

  • bounces=true (was false), ios only
    When true, the scroll view bounces when it reaches the end of the content if the content is larger than the scroll view along the axis of the scroll direction.

Setting this to true will enhance the stability of the viewable items callback on iOS devices.

  • pagingEnabled=false (was true)
    When true, the scroll view stops on multiples of the scroll view's size when scrolling

If the list contains items of inconsistent heights or sizes, enabling pagingEnabled can lead to awkward scroll stop positions and may inaccurately determine which items are viewable.

What alternative solutions did you explore? (Optional)

react-native-snap-carousel

@parasharrajat
Copy link
Member

Thanks for the proposal @mikesmnx but it sounds incomplete. What settings of FlatList especially?

What did you change and why? How will it impact the App? Which flat List as we talking about?

@mikesmnx
Copy link

Hi @parasharrajat

FlatList has complex logic for determining viewable items. The carousel contains a FlatList, where each attachment is a FlatList item (all are hidden except for the selected one). With the previous settings, it incorrectly determined that one or more neighboring attachments were also viewable. As a result, either the wrong image was displayed, or all the attachments were displayed one by one.

Code changes:
src/components/AttachmentCarousel/index.js

const viewabilityConfig = {
    // To facilitate paging through the attachments, we want to consider an item "viewable" when it is
    // more than 90% visible. When that happens we update the page index in the state.
    itemVisiblePercentThreshold: 95,
    minimumViewTime: 300, 
};
<FlatList
                    keyboardShouldPersistTaps="handled"
                    listKey="AttachmentCarousel"
                    horizontal
                    decelerationRate="fast"
                    showsHorizontalScrollIndicator={false}
                    bounces={true}
                    // Scroll only one image at a time no matter how fast the user swipes
                    disableIntervalMomentum
                    pagingEnabled={false}
                    snapToAlignment="start"
                    snapToInterval={containerWidth}
                    // Enable scrolling by swiping on mobile (touch) devices only
                    // disable scroll for desktop/browsers because they add their scrollbars
                    // Enable scrolling FlatList only when PDF is not in a zoomed state
                    scrollEnabled={canUseTouchScreen && !isZoomed}
                    ref={scrollRef}
                    initialScrollIndex={page}
                    initialNumToRender={1}
                    windowSize={3}
                    maxToRenderPerBatch={1}
                    data={attachments}
                    CellRendererComponent={renderCell}
                    renderItem={renderItem}
                    getItemLayout={getItemLayout}
                    keyExtractor={(item) => item.source}
                    viewabilityConfig={viewabilityConfig}
                    onViewableItemsChanged={updatePage}
                />

@melvin-bot melvin-bot bot added the Overdue label Aug 3, 2023
@parasharrajat
Copy link
Member

Reviewing this today. Need to reproduce the bug first.

@melvin-bot melvin-bot bot removed the Overdue label Aug 4, 2023
@mikesmnx
Copy link

mikesmnx commented Aug 4, 2023

It's easier to reproduce the issue in Safari, especially on mobile devices, but Chrome will work too. Just open and close the attachment multiple times.

click-click.mp4

@michaelhaxhiu michaelhaxhiu changed the title [$1000] Wrong Image opens on HT Report in Safari [$2000] Wrong Image opens on HT Report in Safari Aug 4, 2023
@michaelhaxhiu michaelhaxhiu removed their assignment Aug 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 4, 2023

Upwork job price has been updated to $2000

@CortneyOfstad
Copy link
Contributor

Hi @parasharrajat — just checking to see if we're still on pace to have this merged early this week? Thanks!

@parasharrajat
Copy link
Member

As I am back from vacay, I will continue the review and try to get this merged ASAP.

@CortneyOfstad
Copy link
Contributor

Coming from this comment here are we still looking to merge today @parasharrajat? Thanks!

@deetergp
Copy link
Contributor

The PR has been approved but we are currently under a merge freeze. It will likely not be merged until Thursday.

@parasharrajat
Copy link
Member

Same as above.

@CortneyOfstad
Copy link
Contributor

Merge freeze should end today 🤞

@deetergp
Copy link
Contributor

Looks like the freeze is thawing slightly to a slush. Not yet sure what that means for a practical standpoint. This is a pretty big change, so we may need to thaw further before merging it.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 30, 2024
@melvin-bot melvin-bot bot changed the title [$2000] Wrong Image opens on HT Report in Safari [HOLD for payment 2024-06-06] [$2000] Wrong Image opens on HT Report in Safari May 30, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 30, 2024
Copy link

melvin-bot bot commented May 30, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented May 30, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.77-11 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-06-06. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented May 30, 2024

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:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
  • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@parasharrajat] Determine if we should create a regression test for this bug.
  • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@CortneyOfstad] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/402695

@CortneyOfstad
Copy link
Contributor

@parasharrajat can you complete the checklist before tomorrow so there is no delay in payment? Thanks!

@parasharrajat
Copy link
Member

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:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR: None, it is an issue with FlatList on Safari.
  • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: NA
  • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: NA
  • [@parasharrajat] Determine if we should create a regression test for this bug. yes
  • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Regression Test Steps

  1. Open a chat with multiple attachments.
  2. Open and close several attachments randomly.
  3. Confirm that the attachment carousel always opens with the attachment that was selected.

Do you agree 👍 or 👎 ?

@CortneyOfstad
Copy link
Contributor

@parasharrajat can you complete the checklist before tomorrow so there is no delay in payment?

Also, at @mikesmnx can you link your Upwork profile so I can send you a payment contract? After discussing it with the team, it was decided to offer you 25% for your initial work on this. Thanks!

@parasharrajat
Copy link
Member

@CortneyOfstad I already did. Is there something else that I can help with?

@CortneyOfstad
Copy link
Contributor

Sorry, there was a glitch that caused my edited comment to then post on it's own — sorry for the confusion!

@parasharrajat
Copy link
Member

No worries. Thanks.

@mikesmnx
Copy link

mikesmnx commented Jun 5, 2024

Also, at @mikesmnx can you link your Upwork profile so I can send you a payment contract? After discussing it with the team, it was decided to offer you 25% for your initial work on this. Thanks!

@CortneyOfstad https://www.upwork.com/freelancers/~01ae736e03e7dce34c

@parasharrajat
Copy link
Member

@mikesmnx Please close your old PR. Thanks.

@CortneyOfstad
Copy link
Contributor

@mikesmnx and @Talha345 — I've sent you both offers in Upwork. Please let me know once you accept and I'll get those paid ASAP. Thanks!

@Talha345
Copy link
Contributor

Talha345 commented Jun 6, 2024

@mikesmnx and @Talha345 — I've sent you both offers in Upwork. Please let me know once you accept and I'll get those paid ASAP. Thanks!

@CortneyOfstad Offer accepted!

@CortneyOfstad
Copy link
Contributor

CortneyOfstad commented Jun 6, 2024

Regression test created (here) so doing the payment summary now!

@CortneyOfstad
Copy link
Contributor

Payment Summary

@kidroca — contracted
@parasharrajat — to be paid $2,000 via NewDot
@mikesmnx — paid $500 via Upwork (decided on 25% payout due to original PR creation and review process)
@Talha345 — paid $250 for reporting (GH was created pre-pricing change)

Thanks all and great work!

@parasharrajat
Copy link
Member

Payment requested as per #23546 (comment)

@JmillsExpensify
Copy link

$2,000 approved for @parasharrajat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Development

No branches or pull requests