-
Notifications
You must be signed in to change notification settings - Fork 488
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 inconsistent removal of facility filters #7031
Fix inconsistent removal of facility filters #7031
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Deploy Preview for care-egov-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@Omkar76 the facility page filter cache functionality is not working. Steps to reproduce:
|
Debugged it. So Solved this by checking if qParams is empty - in this case we don't remove any params. |
if (Object.keys(qParams).length === 0) return; | ||
if (!qParams.state) { | ||
advancedFilter.removeFilters(["district", "local_body"]); | ||
} | ||
if (!qParams.district) { | ||
advancedFilter.removeFilters(["local_body"]); | ||
} | ||
}, [advancedFilter, qParams]); |
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 still find if (Object.keys(qParams).length === 0) return;
line hard to understand why it's there. Maybe would the following be a more readable and correct approach of what you are trying to do?
cc: @Ashesh3
if (Object.keys(qParams).length === 0) return; | |
if (!qParams.state) { | |
advancedFilter.removeFilters(["district", "local_body"]); | |
} | |
if (!qParams.district) { | |
advancedFilter.removeFilters(["local_body"]); | |
} | |
}, [advancedFilter, qParams]); | |
if (!qParams.state && (qParams.district || qParams.local_body)) { | |
advancedFilter.removeFilters(["district", "local_body"]); | |
} | |
if (!qParams.district && qParams.local_body) { | |
advancedFilter.removeFilters(["local_body"]); | |
} | |
}, [advancedFilter, qParams]); |
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.
The suggestion seems good and reads better.
- If state is not present, but district or local_body is, then remove both
- If district is not preset but we still have local_body, then remove it.
LGTM |
@Omkar76 We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us 🥇. We always welcome your contribution 🙂, so feel free to contribute to anything anytime, and never lose that spirit of innovation 🙌. |
Proposed Changes
@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers
Merge Checklist
facility-filter.webm