Repository navigation
Revert "fix: Offline deleted rules reappear after reconnecting until cache is cleared" - #87675
Conversation
…cache is cleared"
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
There was a problem hiding this comment.
💡 Codex Review
Line 332 in 31e0957
getCustomUnitsForDuplication now returns the source custom-unit objects as-is, which includes rate entries already marked with pendingAction: DELETE. When distance/per-diem features are duplicated in an offline-deletion scenario, those removed rates are copied into the new workspace and can reappear until cache/state is reset. Filter deleted rates out of customUnit.rates before returning duplicated units.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| employeeList: isMemberOptionSelected ? policy.employeeList : {[policy.owner]: policy?.employeeList?.[policy.owner]}, | ||
| id: targetPolicyID, | ||
| name: policyName, | ||
| fieldList: isReportsOptionSelected ? policy?.fieldList : undefined, | ||
| connections: isConnectionsOptionSelected ? policy?.connections : undefined, |
There was a problem hiding this comment.
Filter pending-delete entries before cloning workspace data
In buildDuplicatePolicyData, the duplicate policy now copies employeeList, fieldList, and connections directly from the source policy, so entries still marked with pendingAction: DELETE are carried into the new workspace. If a user deletes members/report fields/connections while offline and duplicates before sync completes, those removed items are reintroduced in the optimistic duplicate state and can persist until a full refresh. Please filter out pending-delete children before assigning these maps.
Useful? React with 👍 / 👎.
| const optimisticCategoryMap = categoriesValues.reduce<Record<string, Partial<PolicyCategory>>>((acc, category) => { | ||
| if (category.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) { | ||
| return acc; | ||
| } | ||
| acc[category.name] = { | ||
| ...category, | ||
| errors: null, |
There was a problem hiding this comment.
Skip deleted categories when building duplicate category map
buildOptimisticPolicyWithExistingCategories now processes every category and forces pendingAction: ADD, including categories that were already marked for deletion. In offline flows, duplicating a workspace after deleting categories will recreate those deleted categories in the target workspace instead of excluding them. The reducer should continue skipping categories with pendingAction: DELETE.
Useful? React with 👍 / 👎.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
🚧 @cead22 has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
(cherry picked from commit 7b20b6b) (cherry-picked to staging by roryabraham)
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.3.58-7 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This is a revert of #85746 ("fix: Offline deleted rules reappear after reconnecting until cache is cleared"). All changes are internal code — optimistic data handling for workspace duplication and pending-delete state filtering in |
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.3.58-9 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.3.59-0 🚀
Bundle Size Analysis (Sentry): |
|
I reviewed the changes in this PR. It reverts #85746, which removed optimistic filtering of pending-delete items during workspace duplication. All changes are internal — optimistic Onyx data handling in No help site changes are required. |
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.3.58-9 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.3.59-4 🚀
|
Tests
Tested with the steps in #87674
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.