-
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
clear policy errors #44130
clear policy errors #44130
Conversation
src/libs/actions/Report.ts
Outdated
@@ -2237,6 +2237,9 @@ function clearPolicyRoomNameErrors(reportID: string) { | |||
pendingFields: { | |||
reportName: null, | |||
}, | |||
errors: { |
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 Thanks for the PR. While the current changes will solve this specific problem, I notice that this will lead into another issue as demonstrated in the video below. Here reload of the report using openReport
with cause the errorFields
to be reset thereby leaving the LHN with GBR which is not correct. I think instead of removing the errors
here, we should not add errors
here. Would this work?
44130-issue-01.mp4
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.
@rojiphil I'll finish this today.
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.
@rojiphil The PR is ready for review. However, I would suggest that we add errorFields
to the failure data.
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.
However, I would suggest that we add
errorFields
to the failure data.
@Nodebrute What problem would it cause if we do not add errorFields
to the failure data?
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.
None. Sorry for the previous comment. We can proceed without adding errorFields
.
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.
@danieldoglas bump
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.
Sorry:
- errorFields is an object, that may contain several types of errors
- For some reason, when we send it with
notFound
, it is deleting thereportName
error
Do you know why that's happening? Are we returning a method SET instead of MERGE when returning the policy?
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.
- errorFields is an object, that may contain several types of errors
- For some reason, when we send it with
notFound
, it is deleting thereportName
errorDo you know why that's happening? Are we returning a method SET instead of MERGE when returning the policy?
Ah! I get your point. @Nodebrute Can you please investigate this?
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 will update today.
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.
@rojiphil I am unable to reproduce this error with openReport; it seems like the issue has been resolved.
Screen.Recording.2024-07-16.at.2.28.31.AM.mov
@rojiphil what is your ETA for the checklist? |
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 am unable to reproduce this error with openReport; it seems like the issue has been resolved.
@Nodebrute I can still reproduce this error with openReport. And I still think we need to investigate this.
Otherwise, we will get this behavior where the GBR will be shown for some time and disappear due to openReport
call i.e. when the user navigates away and then navigates back to the same report .
Here is a test video demonstrating this:
44130-group-name-error.mp4
@@ -654,9 +653,6 @@ function updateGroupChatName(reportID: string, reportName: string) { | |||
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, | |||
value: { | |||
reportName: ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.reportName ?? null, | |||
errors: { |
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 am not sure how our problem gets solved by not setting errors
here. The problem mentioned here still exists. When openReport
is called, errorFields
comes back as follows with null (as shown below) and, strangely, FE resets the errorFields
in report in Onyx. Don’t we need to get to the bottom of this?
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.
Investigating
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.
@rojiphil Hey, I'm still unable to reproduce the issue you're mentioning with RBR. You can check the video below. Even after the openReport
calls, the RBR isn't disappearing. I've also tried reloading the page, but the RBR remains until we manually remove it by pressing the cross. Please let me know if I am missing any step
Screen.Recording.2024-07-22.at.1.54.12.PM.1.1.1.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.
I am not sure how our problem gets solved by not setting
errors
here. The problem mentioned here still exists. WhenopenReport
is called,errorFields
comes back as follows with null (as shown below) and, strangely, FE resets theerrorFields
in report in Onyx. Don’t we need to get to the bottom of this?
We don't need to set errors
here. The backend returns errorFields
in case of failure, which is sufficient to display errors here. We don't even set errors when updating the room name. I don't think we need to include errors
in the failure data when updating the group name. Removing errors seems to address the main issue of removing RBR after pressing the cross. Let me know your thoughts.
App/src/libs/actions/Report.ts
Lines 2293 to 2305 in eec4d6a
const failureData: OnyxUpdate[] = [ | |
{ | |
onyxMethod: Onyx.METHOD.MERGE, | |
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, | |
value: { | |
reportName: previousName, | |
}, | |
}, | |
{ | |
onyxMethod: Onyx.METHOD.MERGE, | |
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, | |
value: {[optimisticRenamedAction.reportActionID]: null}, | |
}, |
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.
@rojiphil Additionally, the backend is returning the merge method, so it is not affecting the existing errorFields in the Onyx.
Screen.Recording.2024-07-22.at.2.41.36.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.
We don't need to set
errors
here. The backend returnserrorFields
in case of failure, which is sufficient to display errors here.
This is a good cleanup. Earlier as mentioned here settings
also had a provision to update room name. But, now, since editing the room name is no longer present within settings
page, we can avoid setting GBR for settings
menu.
@Nodebrute Ok. Let me check this again then with the latest. |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safari44130-web-safari-001.mp4MacOS: Desktop44130-desktop-001.mp4iOS: mWeb Safari44130-mweb-safari-001.mp4Android: Native44130-android-native-001.mp4Android: mWeb Chrome44130-mweb-chrome-001.mp4iOS: Native44130-ios-native-001.mp4 |
We can ignore this as I also cannot reproduce this behaviour now. |
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 Thanks for the changes.
@mountiny Since we are not setting errors
, can we rule out BE returning errors
for any missed condition of updateGroupChatName
API request? It seems like we moved to errorFields
sometime in past. And if at all BE return errors
, then, we have to clear errors
too here.
Otherwise code LGTM and works well too.
@@ -654,9 +653,6 @@ function updateGroupChatName(reportID: string, reportName: string) { | |||
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, | |||
value: { | |||
reportName: ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.reportName ?? null, | |||
errors: { |
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 don't need to set
errors
here. The backend returnserrorFields
in case of failure, which is sufficient to display errors here.
This is a good cleanup. Earlier as mentioned here settings
also had a provision to update room name. But, now, since editing the room name is no longer present within settings
page, we can avoid setting GBR for settings
menu.
@Nodebrute Regarding test steps, let us use |
Thank you @rojiphil, I have updated the steps. |
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.
It should only ever return the errorFields
when error occurs
✋ 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.11-0 🚀
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 9.0.11-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.11-5 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.12-0 🚀
|
Details
Fixed Issues
$ #42765
PROPOSAL: #42765 (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-06-21.at.6.22.33.AM.mov
Android: mWeb Chrome
Screen.Recording.2024-06-21.at.6.34.47.AM.mov
iOS: Native
Screen.Recording.2024-06-21.at.6.50.05.AM.mov
iOS: mWeb Safari
Screen.Recording.2024-06-21.at.6.55.32.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-06-21.at.5.43.14.AM.mov
MacOS: Desktop
Screen.Recording.2024-06-25.at.7.06.02.PM.mov