App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Bulk deleted categories reappear.

Open m-natarajan opened this issue 1 year ago • 22 comments

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: Reproducible in staging?: need reproduction Reproducible in production?: need reproduction If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: 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: @trjExpensify Slack conversation (hyperlinked to channel name): Expensify - Convert

Action Performed:

Be on a slow network 3g

  1. Go to workspace setting
  2. Select category
  3. Bulk select the categories
  4. Delete all the categories

Expected Result:

Deleted categories should not reappear

Actual Result:

Deleted categories reappear

Workaround:

unknown

Platforms:

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

  • [ ] Android: Standalone
  • [ ] Android: HybridApp
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Standalone
  • [ ] iOS: HybridApp
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/bfe1edd4-5598-49e2-b8d8-036134cf5b63

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021861090857183886137
  • Upwork Job ID: 1861090857183886137
  • Last Price Increase: 2024-12-02

m-natarajan avatar Nov 23 '24 19:11 m-natarajan

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Nov 23 '24 19:11 melvin-bot[bot]

Triggered auto assignment to @justinpersaud (AutoAssignerNewDotQuality)

melvin-bot[bot] avatar Nov 23 '24 19:11 melvin-bot[bot]

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

MelvinBot avatar Nov 23 '24 19:11 MelvinBot

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

melvin-bot[bot] avatar Nov 25 '24 16:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 25 '24 16:11 melvin-bot[bot]

Just leaving a note here that I'm going to be OOO starting tomorrow until Dec 9th. If anything requires engineering before then and I'm not around, feel free to reassign.

justinpersaud avatar Nov 28 '24 14:11 justinpersaud

@justinpersaud, @sakluger, @Pujan92 Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Nov 29 '24 09:11 melvin-bot[bot]

@Pujan92 any ideas on this one?

muttmuure avatar Dec 02 '24 14:12 muttmuure

Hi, I'm Povilas from Callstack and I would like to work on this issue.

zirgulis avatar Dec 02 '24 14:12 zirgulis

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

melvin-bot[bot] avatar Dec 02 '24 16:12 melvin-bot[bot]

Thanks @zirgulis! I've assigned you to the issue. Please let us know once you have a proposal for how to fix the issue.

sakluger avatar Dec 02 '24 17:12 sakluger

@sakluger it's very difficult to reproduce this bug reliably, it seems to happen randomly. I've managed to only reproduce this a couple of times, not sure what are the exact steps to reproduce this. It might take quite some time to fully understand what's going on here. I have noticed an error in the browser console coming from onyx that it's not able to set policyCategories_ will keep investigating this image

zirgulis avatar Dec 04 '24 17:12 zirgulis

Cool, thanks for the update @zirgulis. Keep us updated as you investigate!

sakluger avatar Dec 04 '24 18:12 sakluger

@justinpersaud @sakluger @Pujan92 @zirgulis 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!

melvin-bot[bot] avatar Dec 07 '24 10:12 melvin-bot[bot]

@sakluger It seems that the issue here is that the SelectionListWithModal component which is rendering the list items for categories is optimized to incrementally update the list items. In the end of the video (attached in the issue description) we see some not deleted categories appear a few seconds later. I was not able to fully replicate the part where old categories appear and then disappear, but we can see that the items are rendered in batches, which I think caused the glitch described in this issue:

https://github.com/user-attachments/assets/5c240367-7741-45a1-9b63-8a9903d4a3d4

zirgulis avatar Dec 09 '24 09:12 zirgulis

@sakluger For web and desktop platforms, we could try to increase the values of windowSize and updateCellsBatchingPeriod props similarly as in the Search.tsx component. It would render more items in a single render batch, therefore we wouldn't see these slow UI updates. The drawback here is it would also increase the memory usage and would also take longer for the list items to be interactive, that's why it would make the most sense to do this only on web and desktop.

zirgulis avatar Dec 09 '24 13:12 zirgulis

we can see that the items are rendered in batches, which I think caused the glitch described in this issue

@zirgulis That doesn't completely make sense to me. If this was a batch rendering issue, I would think that would just cause some of the categories to take longer to be deleted. Are you saying that when you delete a large set of categories, it splits that operation up into batches and we only complete some of the batches?

sakluger avatar Dec 09 '24 15:12 sakluger

@sakluger we do delete the categories successfully, but after deleting them we render (display) the remaining categories in batches. This is a rendering issue and not related to data flow.

zirgulis avatar Dec 09 '24 16:12 zirgulis

Sounds like a promising lead to me

muttmuure avatar Dec 10 '24 11:12 muttmuure

Can you create a proposal using the template?

muttmuure avatar Dec 10 '24 11:12 muttmuure

@muttmuure

Problem:

In the WorkspaceCategoriesPage users are experiencing visual glitches in the SelectionListWithModal component where:

  • previously deleted items briefly reappear
  • not deleted items are appearing slowly.

Root Cause:

The root cause appears to be suboptimal React Native list configuration parameters:

  • A small windowSize (5) is causing too frequent reconstruction of the visible window

https://github.com/Expensify/App/blob/33ce3015ca28e0ddd72e8ca69aee76dc491e3f5b/src/components/SelectionList/BaseSelectionList.tsx#L102

  • A short updateCellsBatchingPeriod (50ms) is not providing enough time to properly batch and process updates

https://github.com/Expensify/App/blob/33ce3015ca28e0ddd72e8ca69aee76dc491e3f5b/src/components/SelectionList/BaseSelectionList.tsx#L103

  • The combination of these settings leads to inefficient render cycles during item deletion, causing the list to momentarily display stale data

Proposed Changes:

  • Add a check to distinguish web and desktop platforms. Code line to be added
  • Increase windowSize from 5 to 50 to maintain a larger buffer of rendered items (pass as a SelectionListWithModal prop) Code line to be added
  • Extend updateCellsBatchingPeriod from 50ms to 100ms to allow proper batching of updates (pass as a SelectionListWithModal prop) Code line to be added

Important: this should be done only for web and desktop platforms as this can increase the memory usage.

Tests: There could be an automated test introduced to measure proper render times after the categories are deleted

zirgulis avatar Dec 10 '24 14:12 zirgulis

Thanks @zirgulis! Could you please update your proposal to link directly to the files that would change? Here is a good example of a recent proposal that we selected: https://github.com/Expensify/App/issues/53346#issuecomment-2516907592.

sakluger avatar Dec 10 '24 21:12 sakluger

@sakluger I think this commit will showcase the best what I want to change https://github.com/callstack-internal/Expensify-App/commit/0849f9985c55fa9d15ed1626193a79a497ffcf74

zirgulis avatar Dec 12 '24 11:12 zirgulis

Thanks @zirgulis. We ask everyone to follow the same template when making proposals. If you'd like us to consider your proposal, could you please update your existing comment to match the template? The comment I linked above is a good example of a proposal that uses the required template.

sakluger avatar Dec 12 '24 23:12 sakluger

@sakluger I have updated my proposal comment, could you please verify that I'm not missing anything anymore? I was not able to paste the code lines to be changed as permalinks because it's from the other repository (our own fork). Instead I added them as links

zirgulis avatar Dec 13 '24 16:12 zirgulis

@justinpersaud, @sakluger, @Pujan92, @zirgulis Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 17 '24 09:12 melvin-bot[bot]

@Pujan92 can you review @zirgulis's proposal above?

muttmuure avatar Dec 17 '24 11:12 muttmuure

Commenting for Melvin.

sakluger avatar Dec 17 '24 18:12 sakluger

Will ping @Pujan92 I'm not sure they're seeing these

muttmuure avatar Dec 18 '24 00:12 muttmuure

Sorry, I will review this in a day.

Pujan92 avatar Dec 18 '24 08:12 Pujan92