Skip to content

Commit

Permalink
fix(node-types): duplicate node types at sidebar filter pannel
Browse files Browse the repository at this point in the history
  • Loading branch information
MahtabBukhari committed Sep 25, 2024
1 parent 0065e0d commit 50dff7e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/App/SideBar/FilterSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export const FilterSearch = ({ showAllSchemas, setShowAllSchemas, schemaAll, anc
await fetchData(setBudget, setAbortRequests)
}

const uniqueSchemas = (showAllSchemas ? schemaAll : schemaAll.slice(0, 4)).filter(
(schema, index, self) => index === self.findIndex((s) => s.type === schema.type),
)

return (
<SearchFilterPopover
anchorEl={anchorEl}
Expand All @@ -93,7 +97,7 @@ export const FilterSearch = ({ showAllSchemas, setShowAllSchemas, schemaAll, anc
</PopoverHeader>
<PopoverBody>
<SchemaTypeWrapper>
{(showAllSchemas ? schemaAll : schemaAll.slice(0, 4)).map((schema) => (
{uniqueSchemas.map((schema) => (
<SchemaType
key={schema.type}
isSelected={selectedTypes.includes(schema.type as string)}
Expand Down

0 comments on commit 50dff7e

Please sign in to comment.