Skip to content

Commit

Permalink
Try to avoid warning in dropdown facets
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Dec 27, 2022
1 parent 9a0c2e7 commit 8563501
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 5 additions & 3 deletions searchlib/components/Facets/DefaultFacetsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { useAtom } from 'jotai';

import { AccordionFacetWrapper } from '@eeacms/search/components';
import { showFacetsAsideAtom } from '@eeacms/search/state';
import { useSearchContext } from '@eeacms/search/lib/hocs';
import { useSearchContext, useIsMounted } from '@eeacms/search/lib/hocs';

import FacetsList from './FacetsList';

Expand All @@ -32,9 +32,11 @@ export default (props) => {
const searchContext = useSearchContext();
const hasFilters = searchContext.filters.length > 0;

const { mountedRef } = useIsMounted();

React.useEffect(() => {
if (hasFilters) setShowFacets(true);
}, [hasFilters, setShowFacets]);
if (mountedRef.current && hasFilters) setShowFacets(true);
}, [hasFilters, setShowFacets, mountedRef]);

return (
<div className="facets-list">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const DropdownFacetWrapper = (props) => {
sortedOptions,
filterType,
} = props;
// console.log('redraw dropdown facet', field);
const rawSearchContext = useSearchContext();
const {
searchContext: facetSearchContext,
Expand Down

0 comments on commit 8563501

Please sign in to comment.