Fix: Change offline pattern for unassigning cards#52109
Conversation
|
@parasharrajat 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] |
|
@mountiny Could I take over this one? |
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: ONYXKEYS.CARD_LIST, | ||
| value: { | ||
| [cardID]: null, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
this is redundant, right?
| successData: [ | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: `${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${bankName}`, | ||
| value: { | ||
| [cardID]: null, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
this is redundant, right?
There was a problem hiding this comment.
@koko57 We already removed the card on optimistic data
|
Is there a reason for removing me from review? |
|
@DylanDylann test steps updated, removed the unnecessary code |
|
@parasharrajat This PR belongs to the Workspace Feed Project and I am taking over this project. Sorry for the confusion |
|
@DylanDylann done |
|
@koko57 In offline pattern B, we need to grey out the deleted card when users remove it offline and only hide it when receiving response from BE |
|
We need to add pendingAction or pendingField in optimisticData |
@mountiny should we also do this for the Expensify Card? For now we have the same pattern there |
|
#51841 - this PR removes the card optimistically with no card greyed out state - the cards should be removed instantly. Same in the docs:
|
|
@koko57 In this issue, the expected is "Use Pattern B as per document sheet". You mean that we need to use another offline pattern |
|
While implementing this PR, there are no requirements for us to use offline pattern B. So I only fixed the original bug and didn't notice which offline pattern we should use |
|
@DylanDylann so I think it should be discussed then. Nevertheless these changes fix the problem I mentioned in the description:
and there was no error handling and restoring the card if the API call failed. |
|
If we use offline pattern B, we also handle failed cases on API |
|
We need to confirm that should we apply offline pattern B to both deactivating Expensify Card action and unassigning Company Card action? |
|
and other card dectivating actions - like the one reporting fraud in the wallet. |
|
We should apply pattern B to all of those, if there will be issues with error handling we can do pattern C and wait for the action to succeed same as creating a card |
|
Could we possibly merge this one to have at least #51895 fixed? And I could do the change for all the cards actions in a separate PR? WDYT @mountiny @DylanDylann? |
|
I am fine. But give me 30 mins to make the checklist |
|
Thanks |
Reviewer Checklist
Screenshots/VideosiOS: mWeb SafariScreen.Recording.2024-11-07.at.19.55.04.movMacOS: Chrome / SafariScreen.Recording.2024-11-07.at.19.53.53.movMacOS: DesktopScreen.Recording.2024-11-07.at.19.54.33.mov |
|
All done |
|
✋ 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.60-0 🚀
|
Verified this is working as expected. We still seem to be using pattern A for this, as the card is being optimistically removed while offline with no feedback. However I think that is expected and we are addressing in a follow up PR, so checking this off. LMK if not correct. cc @mountiny @koko57 |
Confirmed both cases are working as expected! |
|
@joekaufmanexpensify yes, I will be working on the follow-up today! |
|
Thanks for testing |
|
Course, and sounds good! |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.60-3 🚀
|






Explanation of Change
I also added removing the card from the
cardListas before this change the card was still visible in the members details card section (if you assigned the card to yourself).#51895 - for this one I also disabled the button when loading (bc user was able to click it million times when loading)
Fixed Issues
$ #51876
$ #51895
PROPOSAL:
Tests
#51876
#51895
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
no QA
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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
iOS: mWeb Safari
MacOS: Chrome / Safari
https://github.com/user-attachments/assets/a056a33f-67af-4349-9adf-deb84caddc8d

MacOS: Desktop