-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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/50248 handle card failure data #50644
Fix/50248 handle card failure data #50644
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] |
@@ -43,7 +43,7 @@ | |||
D27CE6B77196EF3EF450EEAC /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0D3F9E814828D91464DF9D35 /* PrivacyInfo.xcprivacy */; }; | |||
DD79042B2792E76D004484B4 /* RCTBootSplash.mm in Sources */ = {isa = PBXBuildFile; fileRef = DD79042A2792E76D004484B4 /* RCTBootSplash.mm */; }; | |||
DDCB2E57F334C143AC462B43 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D20D83B0E39BA6D21761E72 /* ExpoModulesProvider.swift */; }; | |||
E51DC681C7DEE40AEBDDFBFE /* (null) in Frameworks */ = {isa = PBXBuildFile; }; | |||
E51DC681C7DEE40AEBDDFBFE /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; |
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.
@koko57 Why do we need to change this file?
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 see it was changed the same way in 4f1224c, I wonder why this change isn't reflected here yet
src/types/onyx/Card.ts
Outdated
errors?: OnyxCommon.Errors; | ||
|
||
/** Whether the request was successful */ | ||
success?: boolean; |
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.
This should beisSuccessful
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.
@DylanDylann I saw "success" in a few places in the app like in
Line 105 in d77a4fd
success?: string; |
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.
We should follow our convention
App/contributingGuides/STYLE.md
Lines 605 to 622 in ce23fb5
### Boolean variables and props | |
- Boolean props or variables must be prefixed with `should` or `is` to make it clear that they are `Boolean`. Use `should` when we are enabling or disabling some features and `is` in most other cases. | |
```tsx | |
// Bad | |
<SomeComponent showIcon /> | |
// Good | |
<SomeComponent shouldShowIcon /> | |
// Bad | |
const valid = props.something && props.somethingElse; | |
// Good | |
const isValid = props.something && props.somethingElse; | |
``` | |
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.
@DylanDylann shouldShowSuccess would be acceptable? 😅 like here
App/src/types/onyx/WalletTransfer.ts
Line 17 in ce23fb5
/** Whether the success screen is shown to user. */ |
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.
For me, I prefer isSuccessful
because it's more generic
@@ -206,6 +208,8 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM | |||
return <NotFoundPage />; | |||
} | |||
|
|||
const shouldShowCardsSection = (policy?.areExpensifyCardsEnabled && paymentAccountID) ?? policy?.areCompanyCardsEnabled; |
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.
@koko57 while reviewing this PR, I see a bug here
"0" is displayed in the end of WorkspaceMemberDetailsPage
const shouldShowCardsSection = (policy?.areExpensifyCardsEnabled && paymentAccountID) ?? policy?.areCompanyCardsEnabled; | |
const shouldShowCardsSection = (policy?.areExpensifyCardsEnabled && !!paymentAccountID) ?? policy?.areCompanyCardsEnabled; |
@@ -30,6 +30,12 @@ function IssueNewCardPage({policy, route}: IssueNewCardPageProps) { | |||
Card.startIssueNewCardFlow(policyID); | |||
}, [policyID]); | |||
|
|||
useEffect(() => { | |||
return () => { | |||
Card.clearIssueNewCardFlow(); |
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.
Why do we need to clear data here? We already cleared data if the API failed
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 noticed that when we close RHP during the flow and go to another workspace and start the flow for issuing the card we have the data from the previous flow. This may lead to an error when i.e. we have chosen an assignee that is not a member of the new workspace. To avoid such errors, I think it's better to clear the flow everytime it's closed.
cc @mountiny
Welcome back @koko57 will you be able to get this one cleared up today? Thanks |
@mountiny yeah, on it right now! Should be ready shortly |
@DylanDylann changes applied |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-10-16.at.16.05.18.movAndroid: mWeb ChromeScreen.Recording.2024-10-16.at.15.58.11.moviOS: NativeScreen.Recording.2024-10-16.at.16.02.38.moviOS: mWeb SafariScreen.Recording.2024-10-16.at.15.54.57.movMacOS: Chrome / SafariScreen.Recording.2024-10-16.at.15.52.10.movMacOS: DesktopScreen.Recording.2024-10-16.at.15.55.42.mov |
@mountiny All yours |
@koko57 can you please merge with main, sorry for late review (please ping me in slack for quick actions just in case) |
@mountiny conflicts resolved |
@@ -80,6 +82,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM | |||
const ownerDetails = personalDetails?.[policy?.ownerAccountID ?? -1] ?? ({} as PersonalDetails); | |||
const policyOwnerDisplayName = ownerDetails.displayName ?? policy?.owner ?? ''; | |||
const hasMultipleFeeds = Object.values(cardFeeds?.settings?.companyCards ?? {}).filter((feed) => !feed.pending).length > 0; | |||
const paymentAccountID = cardSettings?.paymentBankAccountID ?? 0; |
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.
Nab just to make it clearer
const paymentAccountID = cardSettings?.paymentBankAccountID ?? 0; | |
const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0; |
@mountiny looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
✋ 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.52-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.52-5 🚀
|
Details
Fixed Issues
$ #50248
$ #50441
PROPOSAL:
Tests
Offline tests
QA Steps
same as above
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
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-10-11.at.19.57.37.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2024-10-11.at.19.08.02.mp4
MacOS: Desktop