Skip to content

Commit

Permalink
FE: Bugfix: Cannot reuse filter display name (#321)
Browse files Browse the repository at this point in the history
Co-authored-by: Leshe4ka <[email protected]>
  • Loading branch information
Leshe4ka and Leshe4ka authored Apr 26, 2024
1 parent c402f36 commit 79553e4
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useTopicDetails } from 'lib/hooks/api/topics';
import EditIcon from 'components/common/Icons/EditIcon';
import CloseIcon from 'components/common/Icons/CloseIcon';
import FlexBox from 'components/common/FlexBox/FlexBox';
import { useMessageFiltersStore } from 'lib/hooks/useMessageFiltersStore';

import * as S from './Filters.styled';
import {
Expand Down Expand Up @@ -66,6 +67,7 @@ const Filters: React.FC<FiltersProps> = ({

const { data: topic } = useTopicDetails({ clusterName, topicName });
const [createdEditedSmartId, setCreatedEditedSmartId] = useState<string>();
const remove = useMessageFiltersStore((state) => state.remove);

const partitions = useMemo(() => {
return (topic?.partitions || []).reduce<{
Expand Down Expand Up @@ -209,7 +211,10 @@ const Filters: React.FC<FiltersProps> = ({
<EditIcon />
</S.EditSmartFilterIcon>
<S.DeleteSmartFilterIcon
onClick={() => setSmartFilter(null)}
onClick={() => {
setSmartFilter(null);
remove(smartFilter.id);
}}
disabled={!!createdEditedSmartId}
>
<CloseIcon />
Expand Down

0 comments on commit 79553e4

Please sign in to comment.