[$250] Bulk deleted categories reappear.
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
- Go to workspace setting
- Select category
- Bulk select the categories
- 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
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021861090857183886137
- Upwork Job ID: 1861090857183886137
- Last Price Increase: 2024-12-02
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.
Triggered auto assignment to @justinpersaud (AutoAssignerNewDotQuality)
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
Job added to Upwork: https://www.upwork.com/jobs/~021861090857183886137
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Pujan92 (External)
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, @sakluger, @Pujan92 Whoops! This issue is 2 days overdue. Let's get this updated quick!
@Pujan92 any ideas on this one?
Hi, I'm Povilas from Callstack and I would like to work on this issue.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
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 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
Cool, thanks for the update @zirgulis. Keep us updated as you investigate!
@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!
@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
@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.
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 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.
Sounds like a promising lead to me
Can you create a proposal using the template?
@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
windowSizefrom 5 to 50 to maintain a larger buffer of rendered items (pass as a SelectionListWithModal prop) Code line to be added - Extend
updateCellsBatchingPeriodfrom 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
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 I think this commit will showcase the best what I want to change https://github.com/callstack-internal/Expensify-App/commit/0849f9985c55fa9d15ed1626193a79a497ffcf74
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 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
@justinpersaud, @sakluger, @Pujan92, @zirgulis Whoops! This issue is 2 days overdue. Let's get this updated quick!
@Pujan92 can you review @zirgulis's proposal above?
Commenting for Melvin.
Will ping @Pujan92 I'm not sure they're seeing these
Sorry, I will review this in a day.