Remove cards optimistically#51841
Conversation
|
@ahmedGaber93 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] |
|
@DylanDylann Pressing 'Deactivate Card' on the 'Report Virtual Card Fraud' page briefly shows a 'Not Found' page. not-found-page-shows-for-a-moment.mov |
|
Also, please upload the videos to the checklist |
|
@jayeshmangwani I see
What do you think if we close RHP after clicking deactivate card |
Upload later. I hope it doesn't block your reviewing |
@DylanDylann I didn't get that. Can you elaborate on what you're trying to say here? |
No, it doesn’t. This is just a reminder to follow the checklist |
RCA: The card is removed optimistically --> Not found Page So I suggest we close Report virtual card fraud Page, when clicking on deactivate card |
|
Or could you have any suggestion for this problem? |
|
@DylanDylann Yes we can close the RHP, we are doing same under the Member -> Cards -> Deactivate Card |
|
@mountiny What are your thoughts on this? We are getting a 'Not Found' page for the 'Deactivate Card' under 'Report Fraud.' Should we close the RHP on the 'Deactivate Card' button? |
|
@DylanDylann This issue isn’t solved entirely; we can still see the 'Not Found' page when back navigation occurs not-found-page-appear.mov |
|
@jayeshmangwani Could you please check again? |
|
@DylanDylann yes checked it solved after your latest commit |
|
Code changes look good. I am testing a few things and found something strange happening while loading the wallet. I'm not sure if it’s related to this PR, but I will add the reproduction steps and the issue in a moment. |
|
All yours |
|
Hey @DylanDylann , can you please check if this works fine for you, or if something is messed up on my account? I am getting constant loading for the "Report Virtual Card Fraud" page's button. button-loading.mov |
|
Thanks for making the changes @DylanDylann . I just have a question, if you have context on it: why are we not showing a confirmation modal on Wallet -> Report Fraud -> Deactivate before deactivating the card? We are showing it on the other two pages, so I just wanted to know if you have any context on this. |
@jayeshmangwani Why it is loading? I don't get this problem |
It maybe our implementation before. Not sure |
Finally, I was able to reproduce this on a new account. Repro Steps:
So, if we encounter an error, why does the card disappear? This may not be related to this PR, but I found it while testing, so I'm pasting it here for visibility. on-refrsh-error-card-dispaaear.mov |
@DylanDylann Please ignore this, as I am unable to reproduce it on another account. If I find the exact repro steps, I will post them; otherwise, we can ignore it for this PR. |
|
@jayeshmangwani BE removed data after reloading page, right? |
|
@DylanDylann But if we encounter an error when deactivating, then why is the backend removing the data that I wondering? |
|
As I said before, this is not from this PR, but I noticed it and wanted to mention it here. |
|
@jayeshmangwani Is this ready for checklist?> |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid.movAndroid: mWeb Chromemweb-chrome.moviOS: Nativeios.moviOS: mWeb Safarimweb-safari.movMacOS: Chrome / Safariweb-2.movweb.movMacOS: Desktopdesktop.mov |
mountiny
left a comment
There was a problem hiding this comment.
Changes look good to me
|
|
||
| function reportVirtualExpensifyCardFraud(cardID: number) { | ||
| function reportVirtualExpensifyCardFraud(card?: Card) { | ||
| const cardID = card?.cardID ?? -1; |
There was a problem hiding this comment.
I m still not sure what is the best way to handle these. I feel like that if the cardID is not available we should cut this earlier, but not sure about the best practice here
| }, | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: `${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${card?.fundID ?? '-1'}_${CONST.EXPENSIFY_CARD.BANK}`, |
There was a problem hiding this comment.
same here, if the fundID is not available, this is kinda useless
| const submit = useCallback(() => { | ||
| Navigation.dismissModal(); | ||
| InteractionManager.runAfterInteractions(() => { | ||
| Card.reportVirtualExpensifyCardFraud(virtualCard); | ||
| }); | ||
| }, [virtualCard]); |
There was a problem hiding this comment.
Why did we need this callback here and not in some other pages?
|
Thank you for thorough testing @jayeshmangwani |
|
✋ 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.57-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.0.57-10 🚀
|
Explanation of Change
Remove cards optimistically in both cardList and cards_{workspaceAccountID}_ExpensifyCard when users deactivate cards on all places: Wallet, Member Detail Page, Expensify Card
Fixed Issues
$ #51738
#51739
Tests
QA Steps
Offline tests
QA Steps
Section 1:
Section 2:
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
Screen.Recording.2024-11-01.at.15.34.09.mov
Android: mWeb Chrome
Screen.Recording.2024-11-01.at.15.32.41.mov
iOS: Native
Screen.Recording.2024-11-01.at.15.27.57.mov
iOS: mWeb Safari
Screen.Recording.2024-11-01.at.15.33.35.mov
MacOS: Chrome / Safari
Screen.Recording.2024-11-01.at.15.27.11.mov
MacOS: Desktop
Screen.Recording.2024-11-01.at.15.26.31.mov