Skip to content

Commit

Permalink
fix(native-filters): Add empty text node before OutPortal (#22289)
Browse files Browse the repository at this point in the history
  • Loading branch information
codyml authored Dec 1, 2022
1 parent 3ffe782 commit ffff3e4
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 ffff3e4

Please sign in to comment.