diff --git a/dashboard/src/modules/components/ComparisonComponent/PanelContent.jsx b/dashboard/src/modules/components/ComparisonComponent/PanelContent.jsx index cbdbe5e01b..2c0fc5b1fb 100644 --- a/dashboard/src/modules/components/ComparisonComponent/PanelContent.jsx +++ b/dashboard/src/modules/components/ComparisonComponent/PanelContent.jsx @@ -21,10 +21,12 @@ const PanelConent = () => { } = useSelector((state) => state.comparison); const onFilter = useCallback( (item) => { - if (searchValue === "") { - return true; + if (item) { + if (searchValue === "") { + return true; + } + return item.name.search(searchValue) >= 0; } - return item.name.search(searchValue) >= 0; }, [searchValue] ); @@ -40,33 +42,33 @@ const PanelConent = () => {
{isCompareSwitchChecked ? (
- {filteredDatasets.map((item) => - item ? ( - - dispatch(setSelectedId(checked, item.resource_id)) - } - /> - ) : ( - <> - ) - )} + {filteredDatasets.map((item) => ( + + dispatch(setSelectedId(checked, item.resource_id)) + } + /> + ))}
) : ( {filteredDatasets.map((item) => { - return item ? ( - - ) : ( - <> + const isActiveItem = item.resource_id === activeResourceId; + const itemClassName = isActiveItem + ? "dataset-item active-item" + : "dataset-item"; + return ( + dispatch(getQuisbyData(item))} + key={item.resource_id} + > + {item.name} + ); })}