Skip to content

Commit

Permalink
Merge pull request #36 from concord-consortium/186752847-attribute-se…
Browse files Browse the repository at this point in the history
…lection-fix

Fixes attribute selection after All has been selected
  • Loading branch information
eireland authored Jan 29, 2024
2 parents fc14888 + cc2f503 commit 697ffc8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/attribute-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ export const AttributesSelector = () => {
if (allSelected) {
setAllSelected(false);
draft.frequencies[selectedFrequency] = {attrs: [], filters};
selectedAttr && draft.frequencies[selectedFrequency].attrs.push(selectedAttr);
}
if (selectedAttrName) {
const attrIndex = draftAttrNames.indexOf(selectedAttrName);
if (selectedAttr) {
selectedAttr !== undefined && draft.frequencies[selectedFrequency].attrs.push(selectedAttr);
} else if (selectedAttrName) {
if (selectedAttr !== undefined) {
if (draftAttrNames.includes(selectedAttrName)) {
const attrIndex = draftAttrNames.indexOf(selectedAttrName);
if (attrIndex !== null) {
draft.frequencies[selectedFrequency].attrs.splice(attrIndex, 1);
}
Expand Down

0 comments on commit 697ffc8

Please sign in to comment.