Skip to content

Commit

Permalink
refcator: close the filters sections after add a new filter
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Sep 25, 2024
1 parent b3ed64c commit d4df723
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { AlertButton, useAlert } from '../../../elements/Alert';
import { Sections } from '../../../elements/Sections';
import useSpectraByActiveNucleus from '../../../hooks/useSpectraPerNucleus';
import useSpectrum from '../../../hooks/useSpectrum';
import { options } from '../../../toolbar/ToolTypes';

import { filterOptionPanels } from './index';

Expand Down Expand Up @@ -190,10 +189,15 @@ function FiltersInner(props: FiltersInnerProps) {
isDeleteAllow: true,
});
} else {
setNewFilter(null);
setNewFilter((previousNewFilter) => {
if (previousNewFilter) {
openSection('');
}
return null;
});
}

if (options?.[selectedTool]?.isFilter) {
if (Filters?.[selectedTool]) {
openSection(selectedTool);
}
}, [filters, selectedTool]);
Expand Down

0 comments on commit d4df723

Please sign in to comment.