-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor StaticFilters #50
Conversation
- update StaticFilters to be a functional component - update StaticFilters to use new interface from answers-headless changes in this PR instead of managing its own filter state. - update filter utils to reflect the new interfaces from answers-headless Note: the package/answers-headless version will be updated once that pr is merged and publish. J=SLAP-1661 TEST=manual - hook to local answers-headless changes, and start sample-app. See that filters work accordingly.
…ons from headless
…react into dev/filter-update
…react into dev/filter-update
@@ -75,7 +75,12 @@ function RemovableFilter({ filter }: {filter: DisplayableFilter }): JSX.Element | |||
} | |||
|
|||
const onRemoveStaticFilterOption = () => { | |||
document.getElementById(`${filter.filter.fieldId + "_" + filter.filter.value}`)?.click(); | |||
if (!filter.filterCollectionId) { |
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 this console.error if answers-headless also logs an error for this? maybe filterCollectionId should be a required field of DisplayableFilter
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.
filterCollectionId can't be required for DisplayableFilter since DisplayableFilter can also be use for type Facet or NLP filters, which doesn't have filterCollectionId. A check is needed here because Typescript would yell that filter.filterCollectionId
can be undefined, which is not allow for function setFilterOption. I think it's ok to keep
Refactor StaticFilters and update AppliedFilters to follow the new public interface from answers-headless.
setFilterOption
function instead of performing a click eventJ=SLAP-1661
TEST=manual