-
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
store applied filters in onyx #48312
store applied filters in onyx #48312
Conversation
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 when it comes to strictly this PR, but I found bug in Category filter
and it's probably linked to parser, maybe you can take a look at it @289Adam289 :
- If you create
Category
with&
written inside, select this category inFilters
, save and display results, the whole page crashed:
Screen.Recording.2024-08-30.at.15.42.57.mov
Additionally, it doesn't happen if I create tag with &
alone in it, which encoded version in &
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.
In general code looks good, I have left mostly minor comments about naming, and 1 comment to simplify code.
Good job 👍
@rayane-djouah 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] |
@luacmartins ready for review |
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, left some more small comments
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.
Looks great. Left a small comment.
src/libs/SearchUtils.ts
Outdated
if (keyInCorrectForm) { | ||
return `${CONST.SEARCH.SYNTAX_FILTER_KEYS[keyInCorrectForm]}:${filterValue as string}`; | ||
} | ||
return `${filterValue as string}`; |
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 sanitize the string for the keyword 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.
At first I didn't think it was necessary but after some thought if we add operator symbols to sanitizeString
function and sanitize every word of an input it should prevent some bugs.
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.
While working on keyword filter sanitization i came across another problem. Quotation marks are hard to parse. For example category with a single quote mark breaks the parser and even sanitizing it wont help. I suggest we discuss this problem in another issue cause it may need some fundamental changes in grammar itself. cc @luacmartins @Kicu
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 agree that it'd require changes to the grammar and we can handle that as a separate issue.
src/libs/SearchUtils.ts
Outdated
if ( | ||
filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.CATEGORY || | ||
filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID || | ||
filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE || | ||
filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPENSE_TYPE || | ||
filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAG || | ||
filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.CURRENCY || | ||
filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM || | ||
filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.TO | ||
) { |
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 In
and Has
filters keys
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 can also consider defining a MULTIPLE_VALUES_FILTER_KEYS
const and then check for Object.values(MULTIPLE_VALUES_FILTER_KEYS).includes(filterKey)
instead. This will simplify the condition if we need it in multiple places
I've noticed that we're not excluding duplicate keyword filter values |
I don't think duplicate keyword filter values are a problem. If a user chooses to enter "test test" then I think we should leave it as it is. |
I agree this is not a problem. We're also updating the grammar here that will combine them into a single node |
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
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
I'm gonna merge this PR as is and then work on a follow up to address this comment |
@289Adam289 if you'd like you can remove the |
I can do that |
@289Adam289 I've found a bug:
Expected Results: Only filters relevant to the "chat" type, from the previously saved filter values, should be applied. Actual Results: Filters related to both the "chat" and the original "expense" type from the saved filter values are incorrectly applied together. Screen.Recording.2024-09-10.at.1.08.42.PM.mov |
Regarding the QA steps, steps 9 and 10 should be before "clicking view results button" because we clear the selected values when we click on the button, Could you please update the steps to:
|
I don't think last step is correct. Filter values should be the same as before clicking "ViewResults" |
@289Adam289 We're currently clearing the filters here when we click on "View Results" :
Do we need to change it? |
@289Adam289 We've encountered another bug: The "Reset filters" button is visible on the filters page even when no values have been selected. When accessing the filters page from a different type (e.g., "Chat") and clicking the "Reset filters" button, the filters displayed switch to those related to the "Expense" type instead of remaining consistent with the currently selected type. Screen.Recording.2024-09-10.at.1.54.55.PM.mov |
Onyx is cleared to prevent bugs and make url the only source of truth. So we shouldn't change it. |
It seems like we have a couple of minor bugs left. Let's squash them and get this one merged 😄 |
To clarify about filter values in onyx. However we store the values in onyx only when the form page ( |
Now Onyx is cleared when changing type. Reset button is only visible when filters are set and it clears only advanced filters. |
Screenshots/VideosAndroid: NativeScreen.Recording.2024-09-11.at.11.40.56.AM.movAndroid: mWeb ChromeScreen.Recording.2024-09-11.at.11.33.02.AM.moviOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-09-11.at.11.29.47.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-09-11.at.11.25.31.mp4MacOS: Chrome / SafariScreen.Recording.2024-09-11.at.10.57.34.AM.movMacOS: DesktopScreen.Recording.2024-09-11.at.11.22.55.AM.mov |
@289Adam289, on both the Android native app and mobile Chrome web version, the filter values sometimes do not clear when changing the type. Could you please try to reproduce this issue on your end? Android: NativeScreen.Recording.2024-09-11.at.11.40.56.AM.movAndroid: mWeb ChromeScreen.Recording.2024-09-11.at.11.33.02.AM.mov |
Fixed! thanks! Screen.Recording.2024-09-11.at.1.14.00.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.
LGTM and tests well
@luacmartins all yours! |
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
✋ 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 production by https://github.com/luacmartins in version: 9.0.33-4 🚀
|
Details
Fixed Issues
$ #48156
$ #48407
PROPOSAL:
Tests
Offline tests
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-09-03.at.10.58.07.mov
Android: mWeb Chrome
Screen.Recording.2024-09-03.at.09.28.39.mp4
iOS: Native
Screen.Recording.2024-09-02.at.15.06.02.mp4
iOS: mWeb Safari
Screen.Recording.2024-09-02.at.15.06.02.mov
MacOS: Chrome / Safari
Screen.Recording.2024-09-02.at.14.04.41.mov
MacOS: Desktop