-
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
Remove error when all workspace is deleted #29781
Conversation
@hoangzinh 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/Policy.js
Outdated
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, | ||
value: oldReimbursementAccount, |
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 think we should restore the errors
value only.
src/libs/actions/Policy.js
Outdated
@@ -89,6 +125,10 @@ function updateLastAccessedWorkspace(policyID) { | |||
* @param {String} policyName | |||
*/ | |||
function deleteWorkspace(policyID, reports, policyName) { | |||
const filteredPolicies = _.filter(allPolicies, (policy) => policy.id !== policyID); |
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.
please use lodash instead of underscore for the new code.
src/libs/actions/Policy.js
Outdated
@@ -89,6 +125,10 @@ function updateLastAccessedWorkspace(policyID) { | |||
* @param {String} policyName | |||
*/ | |||
function deleteWorkspace(policyID, reports, policyName) { | |||
const filteredPolicies = _.filter(allPolicies, (policy) => policy.id !== policyID); | |||
const hasActivePolicy = hasActiveFreePolicy(filteredPolicies); |
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 this var is only used 1 place, we can call it directly in the place it used to avoid headaches in naming
@hoangzinh Updated all your suggestions. |
hey @dukenv0307 do you have the same experience as me? the bank account's error is automatically cleared when RHN is closed. Screen.Recording.2023-10-20.at.18.03.33.mov |
@hoangzinh Yes, we should close the app and open it again to keep the error. |
src/libs/actions/Policy.js
Outdated
@@ -96,6 +133,9 @@ function updateLastAccessedWorkspace(policyID) { | |||
* @param {String} policyName | |||
*/ | |||
function deleteWorkspace(policyID, reports, policyName) { | |||
const filteredPolicies = filter(allPolicies, (policy) => policy.id !== policyID); | |||
const oldReimbursementAccount = reimbursementAccount; |
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.
do we need to assign to a temporary var oldReimbursementAccount
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.
I think we need it to store the old value. The current value can be changed after the optimisticData is merged in Onyx.
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.
yeah, but we already built failureData
below, so I think we don't need to cache the oldReimbursementAccount
here. Could you help to verify it again? Don't hesitate to let me know if I'm wrong
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.
Yes, you're right. Updated.
In the recording of GH issue #29235, we don't need to close the app and open it again. I think there is a recent bug/change related to this bank account form. |
@dukenv0307 I think it's related to this issue. Discussing in this issue #27901 (comment) |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2023-11-02.at.22.58.45.-.android.movAndroid: mWeb ChromeScreen.Recording.2023-11-02.at.22.53.18.-.android.chrome.moviOS: NativeScreen.Recording.2023-11-02.at.22.41.00.-.ios.moviOS: mWeb SafariScreen.Recording.2023-11-02.at.22.33.33.-.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2023-11-02.at.16.41.21.-.web.movMacOS: DesktopScreen.Recording.2023-11-02.at.16.44.44.-.desktop.mov |
@dukenv0307 because it's related to optimistic Data, I think we should include Offline test, what do you think? |
@dukenv0307 also please resolve conflict |
@hoangzinh Because the test need to complete bank account flow, I think we need online. |
I think bank account is just setup steps. The main of test step is Go to Setting -> WS -> Delete a WS in offline. |
OK let me add the offline step with pre condition. |
@dukenv0307 let me know when your PR is updated and ready for review |
I updated. |
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.
@dukenv0307 Thanks for update. LGTM
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.
LGMT! I think we should clean up all the underscore
and lodash
imports in this file in a follow up
✋ 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/luacmartins in version: 1.3.96-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.96-15 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.97-7 🚀
|
Details
Remove error when all workspace is deleted
Fixed Issues
$ #29235
PROPOSAL: #29235 (comment)
Tests
Offline tests
Pre-condition: The red dot appears on the avatar that comes from ReimbursementAccount errror
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 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
Android: Native
29235.mp4
Android: mWeb Chrome
Record_2023-10-17-21-23-51.mp4
iOS: Native
Screen.Recording.2023-10-17.at.21.39.52.mov
iOS: mWeb Safari
Screen.Recording.2023-10-17.at.21.36.00.mov
MacOS: Chrome / Safari
Screencast.from.17-10-2023.21.17.01.webm
MacOS: Desktop
Screen.Recording.2023-10-17.at.21.45.47.mov