-
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
[HOLD for payment 2024-11-20] [$250] Search filters - Category list shows default categories when no workspace is created #50564
Comments
Triggered auto assignment to @garrettmknight ( |
@garrettmknight FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
We think that this bug might be related to #wave-control |
Edited by proposal-police: This proposal was edited at 2024-10-16 06:05:34 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Search filters - Category list shows default categories when no workspace is created What is the root cause of that problem?Right here we don't filter out the personal policy for App/src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersCategoryPage.tsx Lines 22 to 32 in 8f5ba1e
And inside AdvancedSearchFilters.tsx we don't hide the categories, tags, and taxes if the list is empty What changes do you think we should make in order to solve the problem?We can create 2 new hooks inside PolicyUtils to get the lists of tags and categories, for taxes we already have right here:
and we will hide the categories, tags and taxes inside AdvancedSearchFilters page if the list is empty function getAllTags(): Record<string, string> {
const tags: Record<string, string> = {};
Object.values(allTags ?? {})?.forEach((policy) => {
if (!policy?.Tag.tags) {
return;
}
Object.entries(policy?.Tag.tags).forEach(([tagKey, tag]) => {
if (!tags[tag.name]) {
tags[tag.name] = tagKey;
return;
}
});
});
return tags;
}
function getAllCategories() {
const uniqueCategoryNames = new Set<string>();
const personalPolicyID = getPersonalPolicy()?.id;
Object.entries(allCategories ?? {})?.forEach(([policyKey, policyCategories]) => {
if (isEmptyObject(policyCategories) || policyKey === `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${personalPolicyID}`) {
return;
}
Object.values(policyCategories ?? {}).forEach((category) => uniqueCategoryNames.add(category.name));
});
return Array.from(uniqueCategoryNames).map((categoryName) => ({name: categoryName, value: categoryName}));
} Then inside AdvancedSearchFilters const tags = getAllTags();
const categories = getAllCategories();
...
else if (key === CONST.SEARCH.SYNTAX_FILTER_KEYS.CATEGORY) {
if (isEmptyObject(categories)) {
return undefined;
}
filterTitle = baseFilterConfig[key].getTitle(searchAdvancedFilters, key, translate);
} else if (key === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAG) {
if (isEmptyObject(tags)) {
return undefined;
}
filterTitle = baseFilterConfig[key].getTitle(searchAdvancedFilters, key, translate);
} else if (key === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE) {
if (isEmptyObject(taxRates)) {
return undefined;
}
filterTitle = baseFilterConfig[key].getTitle(searchAdvancedFilters, taxRates);
} For
App/src/pages/Search/AdvancedSearchFilters.tsx Lines 317 to 321 in ce23fb5
But i think for if (isEmptyObject(cardList)) {
return undefined;
} And Inside the SearchFiltersCategoryPage we can use the new hook we just created App/src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersCategoryPage.tsx Lines 31 to 41 in ce23fb5
to const categoryItems = useMemo(() => {
if (!singlePolicyCategories) {
return PolicyUtils.getAllCategories();
}
return Object.values(singlePolicyCategories ?? {}).map((category) => ({name: category.name, value: category.name}));
}, [singlePolicyCategories]); Here's the test branch ResultWhat alternative solutions did you explore? (Optional) |
Edited by proposal-police: This proposal was edited at 2024-10-11 23:28:14 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Category list shows default categories when no workspace is created What is the root cause of that problem?
we don't filter out the personal policy, which also has categories. What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)
then for the key category, tag, or card, check if its options length is greater than 0, if not, return undefined in:
|
Job added to Upwork: https://www.upwork.com/jobs/~021844424503641996992 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh ( |
Edited by proposal-police: This proposal was edited at 2024-10-14 20:00:32 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?We haven't added checks in the AdvancedSearchFilters component to hide filters when their respective lists (Categories, Tags, Taxes, Cards) are empty. What changes do you think we should make in order to solve the problem?To fix the issue:
If any list (Categories, Tags, Taxes, Cards) is empty, we will return undefined to hide the corresponding filter. Note: if we want to hide the default Categories in SearchFiltersCategoryPage if user is trying to access it using the url: we can add the same check, in SearchFiltersCategoryPage.tsx , component to hide the default category list.
Screen.Recording.2024-10-15.at.2.09.09.AM.mov |
@luacmartins is this an unexpected behavior? |
Yes, we shouldn't show tags in this case. Additionally, we should hide the |
cc @NJ-2020 and @Shahidullah-Muffakir Just in case you missed this comment #50564 (comment), We should hide the filter from |
@fedirjh , Thank you, will update my proposal. |
Here is the test branch, Thank you. |
@fedirjh Done, Thanks Actually i want to upload the video result but seems not working i think maybe there's an issue when trying to upload the file |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@NJ-2020 I think it could be because of the size of the file, I always compress the video before attaching it. |
@garrettmknight, @fedirjh Whoops! This issue is 2 days overdue. Let's get this updated quick! |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.60-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-11-20. 🎊 For reference, here are some details about the assignees on this issue: |
@fedirjh @garrettmknight @fedirjh The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
Payment Summary
BugZero Checklist (@garrettmknight)
|
@fedirjh please complete the checklist when you get a chance. |
BugZero Checklist:
Bug classificationSource of bug:
Where bug was reported:
Who reported the bug:
Regression Test ProposalPrecondition:Test:
Do we agree 👍 or 👎 |
@garrettmknight, @Kicu, @luacmartins, @fedirjh Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@fedirjh thanks - submit the payment request when you're ready! |
Payment summary: @fedirjh owed $250 via NewDot |
$250 approved for @fedirjh |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.47-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Category list should be empty because no workspace is created
Actual Result:
Category list shows default categories when no workspace is created
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6630371_1728540215030.20241010_140142.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @garrettmknightThe text was updated successfully, but these errors were encountered: