-
Notifications
You must be signed in to change notification settings - Fork 3k
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: store reimbursement accounts separately per workspace #24114
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
@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] |
Hi @parasharrajat, this is a draft PR as completely testing this functionality is not possible without backend changes. High-level summary of changes
Requested backend changeInstead of Questions/remarksI'd like to ask for your view on a few decisions that I've made while working on these changes: 1. Different consts for formID (but same value) In However, in They both have the same string value and we use the latter key elsewhere outside of forms, so for the sake of simplification and preventing duplicate Onyx keys, I removed the FORMS.REIMBURSEMENT_ACCOUNT_FORM key and used the other one. 2. I have added a new optional prop App/src/libs/actions/FormActions.js Lines 31 to 33 in ec7b267
However, this is incompatible with storing reimbursement accounts as Onyx collections, as the policy ID is at the end of the Onyx key. Example usage of this new prop: This ensures the correct Onyx key is used for storing the draft values. If the prop is not provided to the Form component nothing changes from its existing behavior, to ensure backwards-compatibility. 3. Removal of an unused component and a few functions |
use
Please revert
Didn't get it. |
Here is an example: If you provide Onyx.merge(`${formID}Draft`, draftValues); Which will use the However, as I've changed reimbursementAccount to a collection, i.e. reimbursementAccount_12345, this would become: Using the |
Why did you convert it to the collection? |
To allow appending the policy ID to the reimbursement account, preventing the data from spilling over between workspaces. |
I see. What if we use https://github.com/Expensify/react-native-onyx/blob/80c6f001e27e798ed56cc4f3a39ee27c5efae375/lib/Onyx.js#L142 to check if a key is collection and then append |
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.
- Change the title to be more descriptive.
- Add Tests and QA tests.
- Add offline tests.
- Complete the checklist by following each item in it.
Yes, that sounds like a superior approach. I will work on its implementation. |
With regards to using |
Friendly bump |
@parasharrajat Please provide an update, or if you are OOO, perhaps it can be re-assigned to another C+? |
Yeah, I wasn't much active the last 3 days. Going to review this today. It came out to be very big than what I expected which makes a difference as we didn't discuss the whole approach before moving to the PR. |
It was decided to close this issue, so I'm closing the PR. |
Details
Store reimbursement accounts separately per workspace.
Fixed Issues
$ #23480
PROPOSAL: #23480 (comment)
Tests
Precondition: The user has two workspaces with no bank account details set yet.
Offline tests
QA Steps
Precondition: The user has two workspaces with no bank account details set yet.
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
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)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)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
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android