-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: maintain tax assign when tax code changes #47327
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
Conversation
@rushatgabhane 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-08-27.at.17.56.12.movAndroid: mWeb ChromeiOS: NativeScreen.Recording.2024-08-27.at.17.53.13.moviOS: mWeb SafariScreen.Recording.2024-08-27.at.17.54.14.movMacOS: Chrome / SafariScreen.Recording.2024-08-27.at.17.51.42.mov |
const customUnits = Object.values(policy?.customUnits ?? {}); | ||
const optimisticCustomUnit = { | ||
customUnits: { | ||
...customUnits.reduce((units, customUnit) => { |
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.
Maybe I'm misunderstanding but wouldn't this be better as a map instead of a reduce? Same with the rates.reduce below
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.
As far as I know, we can't add properties to an object using map
, so I need to use reduce
here.
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.
customUnits is an array though right? Could do something here like
customUnits: customUnits.map((customUnit) => {
let newUnit = customUnit;
// modify rates
return newUnit
})
Seems a little cleaner? And could use a forEach for the rates object?
what do you think @rushatgabhane
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.
agree with ^
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.
But since customUnits
in optimistic data is of type Record<string, any>
, after this we will have to either do an Array.reduce
or Object.assign
to the updated customUnits
anyway.
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.
oh yeah, fair. Okay then I think this works for me! Thank you for the explanation, that was helpful!
if (customUnit.rates[rateID].attributes?.taxRateExternalID === oldTaxCode) { | ||
// eslint-disable-next-line no-param-reassign | ||
rates[rateID] = { | ||
attributes: { |
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.
also do we need to spread the old rate here? to make sure we don't remove everything but attributes
?
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 is a merge call, so I think we don't need to include everything inside.
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.
oh yep
✋ 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/dangrous in version: 9.0.27-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.27-1 🚀
|
Details
Fixed Issues
$ #45861
PROPOSAL: #45861 (comment)
Tests
Offline tests
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-08-13.at.23.27.14.mov
Android: mWeb Chrome
Screen.Recording.2024-08-13.at.23.19.07.mov
iOS: Native
Screen.Recording.2024-08-13.at.23.50.25.mov
iOS: mWeb Safari
Screen.Recording.2024-08-13.at.23.47.52.mov
MacOS: Chrome / Safari
Screen.Recording.2024-08-13.at.20.28.04.mov
MacOS: Desktop
Screen.Recording.2024-08-13.at.23.56.25.mov