-
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 tagList highlight #31652
Fix tagList highlight #31652
Conversation
@robertKozik 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] |
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
lint looks to be failing @luacmartins |
reviewing this (coming from https://expensify.slack.com/archives/C01GTK53T8Q/p1700598717809329) |
I think I found the root cause why not working on edit case:
App/src/components/TagPicker/index.js Line 56 in da549c0
|
You can test and verify fix by console logging |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2023-11-22.at.4.44.56.AM.movMacOS: Desktop |
I applied my original fix and the latest changes, but I still see the issue with 3 or more tags 🤔 |
Can you please share your video? |
This is what I'm seeing, but I don't quite understand why since logging Screen.Recording.2023-11-21.at.3.54.12.PM.mov |
Please try lodash filter instead of underscore or native method - Object.values().filter() |
I tried that and they also didn't work |
Ok, I pushed a fix that sorts the tag names first and then filters them. That's in line with what we do here |
const sortedTagList = _.chain(policyTagList) | ||
.values() | ||
.sortBy((policyTag) => policyTag.name) | ||
.value(); |
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.
Let's add policyTag.enabled
filter logic here as we don't show disabled tags in any case
As you see, wrong index after I disable 2nd tag, though not visually noticeable
Screen.Recording.2023-11-22.at.6.01.51.AM.mov
if (!shouldShowDisabledAndSelectedOption) { | ||
return sortedTagList; | ||
} |
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.
Actually I don't see the need of this early return.
Can't we apply same logic to both new request and edit request?
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'm not too sure either. The name suggests that we display disabled tags, but I'm not sure that that's happening
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.
@tienifr @robertKozik could you check this logic? It seems like we'd want to return the policyTagList
if shouldShowDisabledAndSelectedOption
is true and not the inverse like we have in the code, right?
@luacmartins please pull main. The issue we're concerning about was already happening on production. #31475 was just merged |
Ah so this has been solved already. Gonna close the PR. |
cc @robertKozik @srikarparsi @tienifr
Details
We started rendering
enabledTags
in this PR, but we were still usingpolicyTagList
to define theinitialFocusedIndex
which threw off the indexesFixed Issues
$ #31578
Tests
Precondition: enable tags as a workspace's admin following these instructions
Offline tests
N/A
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 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)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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov
MacOS: Desktop