Skip to content

Commit

Permalink
Manage deletion of attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoldowsky committed Sep 13, 2024
1 parent 9ec6bc0 commit 9c22dc6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/plugins/bar-graph/bar-graph-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,16 @@ export const BarGraphContentModel = TileContentModel
self.setPrimaryAttribute(atts[0].id);
}
}
}
// Check if primary or secondary attribute has been deleted
if (self.primaryAttribute && !self.sharedModel?.dataSet.attrFromID(self.primaryAttribute)) {
self.setPrimaryAttribute(undefined); // this will also unset secondaryAttribute

Check warning on line 167 in src/plugins/bar-graph/bar-graph-content.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/bar-graph/bar-graph-content.ts#L167

Added line #L167 was not covered by tests
}
if (self.secondaryAttribute && !self.sharedModel?.dataSet.attrFromID(self.secondaryAttribute)) {
self.setSecondaryAttribute(undefined);

Check warning on line 170 in src/plugins/bar-graph/bar-graph-content.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/bar-graph/bar-graph-content.ts#L170

Added line #L170 was not covered by tests
}
}
}
}));
}));

export interface BarGraphContentModelType extends Instance<typeof BarGraphContentModel> {}

Expand Down

0 comments on commit 9c22dc6

Please sign in to comment.