Skip to content

Commit

Permalink
fix(native-filters): cascading filters not rendering in tab (apache#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro authored and cccs-RyanS committed Dec 17, 2021
1 parent 6bfb689 commit 893ccc3
Showing 1 changed file with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const FilterControls: FC<FilterControlsProps> = ({
}));
return buildCascadeFiltersTree(filtersWithValue);
}, [filterValues, dataMaskSelected]);
const cascadeFilterIds = new Set(cascadeFilters.map(item => item.id));

let filtersInScope: CascadeFilter[] = [];
const filtersOutOfScope: CascadeFilter[] = [];
Expand All @@ -93,23 +94,25 @@ const FilterControls: FC<FilterControlsProps> = ({

return (
<Wrapper>
{portalNodes.map((node, index) => (
<portals.InPortal node={node}>
<CascadePopover
data-test="cascade-filters-control"
key={cascadeFilters[index].id}
visible={visiblePopoverId === cascadeFilters[index].id}
onVisibleChange={visible =>
setVisiblePopoverId(visible ? cascadeFilters[index].id : null)
}
filter={cascadeFilters[index]}
onFilterSelectionChange={onFilterSelectionChange}
directPathToChild={directPathToChild}
/>
</portals.InPortal>
))}
{portalNodes
.filter((node, index) => cascadeFilterIds.has(filterValues[index].id))
.map((node, index) => (
<portals.InPortal node={node}>
<CascadePopover
data-test="cascade-filters-control"
key={cascadeFilters[index].id}
visible={visiblePopoverId === cascadeFilters[index].id}
onVisibleChange={visible =>
setVisiblePopoverId(visible ? cascadeFilters[index].id : null)
}
filter={cascadeFilters[index]}
onFilterSelectionChange={onFilterSelectionChange}
directPathToChild={directPathToChild}
/>
</portals.InPortal>
))}
{filtersInScope.map(filter => {
const index = cascadeFilters.findIndex(f => f.id === filter.id);
const index = filterValues.findIndex(f => f.id === filter.id);
return <portals.OutPortal node={portalNodes[index]} />;
})}
{showCollapsePanel && (
Expand Down

0 comments on commit 893ccc3

Please sign in to comment.