fix(native-filters): Add empty text node before OutPortal (#22289)

This commit is contained in:
Cody Leff 2022-12-01 02:56:11 -07:00 committed by GitHub
parent 3ffe7828a7
commit ffff3e4bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -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],
);