-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use pattern B for unassigning cards #52357
fix: use pattern B for unassigning cards #52357
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] |
src/libs/actions/CompanyCards.ts
Outdated
@@ -244,14 +244,20 @@ function unassignWorkspaceCompanyCard(workspaceAccountID: number, bankName: stri | |||
onyxMethod: Onyx.METHOD.MERGE, | |||
key: `${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${bankName}`, | |||
value: { | |||
[cardID]: null, | |||
[cardID]: { | |||
...card, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...card, |
src/libs/actions/CompanyCards.ts
Outdated
}, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: ONYXKEYS.CARD_LIST, | ||
value: { | ||
[cardID]: null, | ||
[cardID]: { | ||
...card, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...card, |
src/libs/actions/CompanyCards.ts
Outdated
@@ -263,6 +269,7 @@ function unassignWorkspaceCompanyCard(workspaceAccountID: number, bankName: stri | |||
value: { | |||
[cardID]: { | |||
...card, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...card, |
src/libs/actions/CompanyCards.ts
Outdated
@@ -273,6 +280,7 @@ function unassignWorkspaceCompanyCard(workspaceAccountID: number, bankName: stri | |||
value: { | |||
[cardID]: { | |||
...card, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...card, |
@koko57 Please add [cardID]: null, to successData |
@DylanDylann changes applied. |
@koko57 There are no card display on member detail page on my account ![]() It dues to this condition
Please help to update to use || instead of ?? |
disabled={isCardDeleted} | ||
shouldShowRightIcon={!isCardDeleted} | ||
style={[isCardDeleted ? styles.offlineFeedback.deleted : {}]} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disabled={isCardDeleted} | |
shouldShowRightIcon={!isCardDeleted} | |
style={[isCardDeleted ? styles.offlineFeedback.deleted : {}]} | |
/> | |
shouldShowRightIcon |
I believe that we shouldn't prevent user from going to detail card page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iconWidth={variables.iconSizeExtraLarge} | ||
iconHeight={variables.iconSizeExtraLarge} | ||
onPress={() => navigateToDetails(memberCard)} | ||
shouldRemoveHoverBackground={isCardDeleted} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldRemoveHoverBackground={isCardDeleted} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/> | ||
))} | ||
{(memberCards as MemberCard[]).map((memberCard) => { | ||
const isCardDeleted = memberCard.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isCardDeleted = memberCard.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should be able to visit that page because the card was already removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mountiny @DylanDylann I've just added the check to disable going to details page after unassigning
@DylanDylann done |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-11-12.at.20.54.01.movAndroid: mWeb ChromeScreen.Recording.2024-11-12.at.20.52.26.moviOS: NativeScreen.Recording.2024-11-12.at.20.51.51.moviOS: mWeb SafariScreen.Recording.2024-11-12.at.20.50.58.mov |
Minor comment: #52357 (comment) The rest looks fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, great job!
✋ 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.61-0 🚀
|
Confirmed both of these work as expected. @koko57 one thing I noticed is if you unassign your own card, we aren't optimistically removing it on the wallet page. Is that expected? |
Confirmed this is working now too! |
@joekaufmanexpensify good catch! I will check it tomorrow |
TY! |
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.61-3 🚀
|
I also fixed the problem I mentioned here: #51876 (comment)
and was then posted in this thread https://callstack-hq.slack.com/archives/C049HHMV9SM/p1730983704782069
Explanation of Change
Fixed Issues
$ #51876
PROPOSAL: -
Tests
Avatar problem
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop