Skip to content

Commit

Permalink
Add empty text node before OutPortal.
Browse files Browse the repository at this point in the history
  • Loading branch information
codyml committed Dec 1, 2022
1 parent 3ffe782 commit 9f38723
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,14 @@ const FilterControls: FC<FilterControlsProps> = ({
const renderer = useCallback(
({ id }: Filter | Divider) => {
const index = filtersWithValues.findIndex(f => f.id === id);
return <OutPortal key={id} node={portalNodes[index]} inView />;
return (
// Empty text node is to ensure there's always an element preceding
// the OutPortal, otherwise react-reverse-portal crashes
<React.Fragment key={id}>
{'' /* eslint-disable-line react/jsx-curly-brace-presence */}
<OutPortal node={portalNodes[index]} inView />
</React.Fragment>
);
},
[filtersWithValues, portalNodes],
);
Expand Down

0 comments on commit 9f38723

Please sign in to comment.