Improve feed removal flow offline#54425
Conversation
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
| return Object.fromEntries(Object.entries(companyCards).filter(([key]) => key !== CONST.EXPENSIFY_CARD.BANK)); | ||
| function getCompanyFeeds(cardFeeds: OnyxEntry<CardFeeds>, shouldFilterOutRemovedFeeds = false): CompanyFeeds { | ||
| return Object.fromEntries( | ||
| Object.entries(cardFeeds?.settings?.companyCards ?? {}).filter(([key, value]) => { |
There was a problem hiding this comment.
@VickyStash Why do we remove cardFeeds?.settings?.oAuthAccountDetails here? As I understand, direct feeds will be saved in oAuthAccountDetails
There was a problem hiding this comment.
Right now, both custom and direct feed settings are stored under the companyCards field. oAuthAccountDetails stores only data for direct feed card assignment.
See the data:
[
{
"key": "sharedNVP_private_domain_member_18461622",
"onyxMethod": "set",
"value": {
"settings": {
"companyCardNicknames": {
"oauth.americanexpressfdx.com 1001": "American Express cards1",
"vcf": "Visa cards1"
},
"companyCards": {
"cdf": {
"pending": true
},
"oauth.americanexpressfdx.com 1001": {
"asrEnabled": false,
"forceReimbursable": "force_no",
"liabilityType": "personal",
"preferredPolicy": "D6A2FBEF5E601C15",
"reportTitleFormat": "",
"shouldApplyCashbackToBill": true,
"statementPeriodEndDay": 1,
"uploadLayoutSettings": []
}
},
"oAuthAccountDetails": {
"oauth.americanexpressfdx.com 1001": {
"accountList": [
"Business Green Rewards Card - 1001"
],
"credentials": "Fv6DIZqi836JYuSLyfsvzwiIQyQSIcfwBu7Mb50pxJsDjEdP2vKee64s6fjokcVu3JYgsQEL2K7qb3ItXY+kOgzyy/syGrQoMHikkvBAqhNUnzfHX1CdFoRXxXtaISS8PliI/tMXy6rnXe8CDYrbHh74lDqLHq9Xy9x4xyZ0tdUfKxC/T8yj1oVzJDQkFzVsQ5oM8cuZWdTPni9EoSKlF7q8xgwydXJIVbb3ISdHFQ27wlq3b0kT9huLe0WW17HGv8soxgTT3iJ8Bb7q5PTzLwxy7ZsLKZtPvctimAZ0Kf1tgLEwMiXeF1rzaeghzhbk5tYGSP8hmkpfNmosFtWTNvLZzFreS8ze1pUUUO6pG7ZfBDiSLkHN3nfR6LVpV3egWHofK60a7OkId9e0Ijk8wuU9p7PEpBXQI8DXeZ9WiutPuJA=",
"expiration": 1734970968
}
}
}
}
},
]
Please, see related discussion in slack.
|
I'm going to be OOO Dec 25 - Dec 29 🎄 |
|
I will try to complete my review today |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-12-24.at.23.11.50.movAndroid: mWeb ChromeScreen.Recording.2024-12-24.at.23.13.13.moviOS: NativeScreen.Recording.2024-12-24.at.23.09.54.moviOS: mWeb SafariScreen.Recording.2024-12-24.at.23.14.24.movMacOS: Chrome / SafariScreen.Recording.2024-12-24.at.23.08.38.movMacOS: DesktopScreen.Recording.2024-12-24.at.23.10.43.mov |
mountiny
left a comment
There was a problem hiding this comment.
Thanks! Only one NAB you can address later
| optimisticData.push({ | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: `${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${policyID}`, | ||
| value: feedToOpen ?? null, | ||
| }); |
There was a problem hiding this comment.
NAB: no need to push this right? we can just add it to the array above
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.80-1 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.0.80-6 🚀
|
|
Tested this with both a direct and custom feed and confirmed both worked as expected! |
| const successFeedUpdates = {[bankName]: null}; | ||
| const failureFeedUpdates = {[bankName]: {pendingAction: null, errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage')}}; | ||
| const optimisticCardUpdates = Object.fromEntries(cardIDs.map((cardID) => [cardID, {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}])); | ||
| const successAndFailureCardUpdates = Object.fromEntries(cardIDs.map((cardID) => [cardID, {pendingAction: null}])); |
There was a problem hiding this comment.
We should set null instead of {pendingAction: null} for optimistic success data.
More details: #74301 (comment)
Explanation of Change
Improve feed removal flow offline
Fixed Issues
$ #54379
PROPOSAL: N/A
Tests
Offline tests
Same, as in the Tests section.
QA Steps
Same, as in the Tests section.
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))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.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
ios1.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
web1.mp4
MacOS: Desktop
desktop1.mp4