-
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
Tags - Violation for unselected dependent tags displays tag name briefly then changes to "tag" #40741
Conversation
…ion-for-multi-level-dependencies
I think we should update and move a few things, let me know what you think
|
I applied your suggestions locally and the correct data is being stored optimistically, but the API overwrites it 😞 This is why I used the same logic that we use to generate the optimistic violations after the data is fetched from the API |
Yeah, that also happens today with the existing violations, but so long as we display the correct violations, that's fine. If we want to refactor this, I think we should do it in a separate issue. I think we'll need a separate issue to handle the |
…ion-for-multi-level-dependencies
They are displayed correctly until the API data overwrites the local data, thus causing the bug again 😅 I think this needs to be handled from the backend side! |
…ion-for-multi-level-dependencies
Just pushed the fix, let me know if there's anything else that needs polishing 😄 |
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.
Code looks good. Let's add some tests too!
…ion-for-multi-level-dependencies # Conflicts: # src/libs/PolicyUtils.ts
All feedback addressed and test case added! 😄 |
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.
Code is looking good! Let's add manual tests
@pac-guerreiro do you have an ETA for this PR? |
…ion-for-multi-level-dependencies # Conflicts: # src/libs/PolicyUtils.ts
Feedback applied, added manual tests and filled PR author checklist. Only things missing now are screen recordings 😄 |
…ion-for-multi-level-dependencies
Ping me when ready for review :) |
Sorry for the delay, I was having problems building the app on android but after an intensive cleaning process I was able to 😅 All screen recordings added! Feel free to review and let me know when I can set this PR as ready for review 😄 |
@pac-guerreiro This step failed on my end when in offline mode. |
@hoangzinh Strange, can you provide a screen recording while testing that step? Here is a screen recording I took while doing the steps on my side: Screen.Recording.2024-06-04.at.23.25.27.mp4 |
@pac-guerreiro sorry I couldn't reproduce that bug anymore. |
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. all yours @cead22
let newTransactionViolations = [...transactionViolations]; | ||
newTransactionViolations = newTransactionViolations.filter( |
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.
Why was this removed? I think we should keep it so we're not adding SOME_TAG_LEVELS_REQUIRED to an array of violations that already has 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.
@cead22 I removed it because we're already filtering those in the function that calls this one 😅
…ion-for-multi-level-dependencies # Conflicts: # src/libs/Violations/ViolationsUtils.ts
…ion-for-multi-level-dependencies
@@ -79,8 +79,28 @@ function useViolations(violations: TransactionViolation[]) { | |||
})); | |||
} | |||
|
|||
// missingTag has special logic for policies with dependent tags, because only one violation is returned for all tags | |||
// when no tags are present, so the tag name isn't set in the violation data. That's why we add it here | |||
if (policyHasDependentTags && currentViolations[0]?.name === CONST.VIOLATIONS.MISSING_TAG && data?.tagListName) { |
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.
Just a suggestion: currentViolations[0]
is used several times so we can create a variable for this like firstViolation
.
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.
@hoangzinh can you give it another quick review and test please? If everything looks good, I'll merge it
Looks good, tested again on Web & IOS Screenshots/VideosiOS: NativeScreen.Recording.2024-06-10.at.13.50.47.ios.movMacOS: Chrome / SafariScreen.Recording.2024-06-10.at.13.29.30.web.mp4 |
🚀 Deployed to staging by https://github.com/cead22 in version: 1.4.82-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.82-4 🚀
|
Details
Fixed Issues
$ #38095
PROPOSAL:
Tests
Submit expense
in a workspace you just createdmanual
and enter any valid amountmissing {tagName}
, wheretagName
is the name of the tag fieldmissing tag
on every tag fieldmissing {tagName}
is replaced byall tags required
on every tag fieldsOffline tests
Scenario A - Violations are shown correctly after synching with the server
Scenario B - Violations are shown correctly while offline
QA Steps
Same as tests
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
Android.-.Native.mp4
Android: mWeb Chrome
Android.-.Chrome.mp4
iOS: Native
iOS.-.Native.mp4
iOS: mWeb Safari
iOS.-.Safari.mp4
MacOS: Chrome / Safari
MacOS.-.Chrome.mp4
MacOS: Desktop
MacOS.-.Desktop.mp4