Skip to content

Commit

Permalink
Merge pull request #2227 from MahtabBukhari/duplicate_node_types_at_s…
Browse files Browse the repository at this point in the history
…idebar_filter_pannel

[Sidebar-Filter] - duplicate node types at sidebar filter pannel ( Better to add check at frontend side to avoid from duplicates
  • Loading branch information
Rassl authored Sep 25, 2024
2 parents d3f0d4e + 50dff7e commit d1e8c92
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 @@ -78,6 +78,10 @@ export const FilterSearch = ({
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 @@ -102,7 +106,7 @@ export const FilterSearch = ({
</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 d1e8c92

Please sign in to comment.