-
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 invoice category #49142
fix invoice category #49142
Conversation
@rayane-djouah 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] |
@@ -168,6 +168,10 @@ function IOURequestStepConfirmation({ | |||
if (policyExpenseChat?.policyID && policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { | |||
openDraftWorkspaceRequest(policyExpenseChat.policyID); | |||
} | |||
const isSender = participants?.find((participant) => participant.isSender); |
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 isSender = participants?.find((participant) => participant.isSender); | |
const senderPolicyParticipant = participants?.find((participant) => participant.isSender); |
@@ -168,6 +168,10 @@ function IOURequestStepConfirmation({ | |||
if (policyExpenseChat?.policyID && policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { | |||
openDraftWorkspaceRequest(policyExpenseChat.policyID); | |||
} | |||
const isSender = participants?.find((participant) => participant.isSender); | |||
if (isSender?.policyID && policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { |
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've noticed that when we change the invoice sender policy, the effect runs twice because the participants
change and then the policy
changes. This causes the API request to run twice. To prevent this, we need to add a check to ensure the API is called only once:
if (isSender?.policyID && policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { | |
if (senderPolicyParticipant?.policyID && policy?.id === senderPolicyParticipant?.policyID && policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { |
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.
Hey @rayane-djouah, Even on the latest main branch, the effect runs three times and the API is called three times when we use submit expense flow.
Screen.Recording.2024-09-16.at.3.00.24.AM.mov
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.
@Nodebrute I believe this is a bug. We only need to call the API once when the policy changes, so isOffline
, participants
, and policy?.pendingAction
should be the only necessary useEffect dependencies.
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.
@rayane-djouah With the recent changes, I tested it again, and it’s working fine now.
Co-authored-by: rayane-djouah <[email protected]>
Co-authored-by: rayane-djouah <[email protected]>
Co-authored-by: rayane-djouah <[email protected]>
src/libs/ReportUtils.ts
Outdated
@@ -458,6 +458,7 @@ type OptionData = { | |||
tabIndex?: 0 | -1; | |||
isConciergeChat?: boolean; | |||
isBold?: boolean; | |||
isSender?: 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 property is not used, let's remove it
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.
If we remove this property, we get a type error 'isSender' does not exist on type 'OptionData | Participant'. Property 'isSender' does not exist on type 'OptionData'.
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.
@Nodebrute Let's update the condition to:
const senderPolicyParticipant = participants?.find((participant) => !!participant && 'isSender' in participant && participant.isSender);
and remove isSender
property from OptionData
type.
@Nodebrute Friendly bump |
@rayane-djouah Thank you for your patience! I’ve made and tested the suggested changes, and they work well. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-09-22.at.5.17.42.PM.movAndroid: mWeb ChromeScreen.Recording.2024-09-22.at.5.56.47.PM.moviOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-09-22.at.17.14.19.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-09-22.at.17.24.27.mp4MacOS: Chrome / SafariScreen.Recording.2024-09-22.at.5.16.37.PM.movMacOS: DesktopScreen.Recording.2024-09-22.at.5.17.15.PM.mov |
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.
LGTM and tests well
@stitesExpensify all yours! |
@Nodebrute looks like there is an eslint failure |
|
@stitesExpensify It seems to be failing because of this. Do you think we should address it in this PR? |
Based on that comment, I think that we should |
@stitesExpensify I’ve migrated this to useOnyx! 🎉 It was a bit complicated. I’ve tested it, everything’s looking good on my end. Just so we’re clear, I’m not taking the fall if anything goes haywire 😁 @rayane-djouah can you review this again? |
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.
LGTM and tests well
@stitesExpensify all yours! |
✋ 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/stitesExpensify in version: 9.0.41-0 🚀
|
Failing with original KI #47922 in iOS https://platform.applause.com/services/links/v1/external/be5003de470290723ceaa71e84a45cf6e02372b1bc208704e2ea71aff36b42f6 |
@kavimuru This feature requires internet connection |
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.41-10 🚀
|
Details
Fixed Issues
$ #47922
PROPOSAL: #47922 (comment)
Tests
Offline tests
Same as above
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
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
Screen.Recording.2024-09-13.at.6.06.17.AM.mov
Android: mWeb Chrome
Screen.Recording.2024-09-13.at.6.10.26.AM.mov
iOS: Native
Screen.Recording.2024-09-13.at.5.13.28.AM.mov
iOS: mWeb Safari
Screen.Recording.2024-09-13.at.4.03.37.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-09-13.at.3.57.13.AM.1.1.mov
MacOS: Desktop
Screen.Recording.2024-09-13.at.3.58.48.AM.mov