Skip to content

Commit

Permalink
fix: item info map after sorting items (#1572)
Browse files Browse the repository at this point in the history
  • Loading branch information
kswenson authored Oct 29, 2024
1 parent 3af35e5 commit ca9fa2e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions v3/src/models/data/data-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,12 @@ export const DataSet = V2Model.named("DataSet").props({
validateCases() {
if (!self.isValidCases) {
self.caseInfoMap.clear()
self.itemInfoMap.forEach(item => item.caseIds = [])
const itemsToValidate = new Set<string>(self.itemInfoMap.keys())
self.itemInfoMap.clear()
self._itemIds.forEach((itemId, index) => {
self.itemInfoMap.set(itemId, { index, caseIds: [] })
itemsToValidate.delete(itemId)
})
self.collections.forEach((collection, index) => {
// update the cases
collection.updateCaseGroups()
Expand All @@ -549,11 +554,8 @@ export const DataSet = V2Model.named("DataSet").props({
self.childCollection.caseGroups.forEach(caseGroup => {
self.itemIdChildCaseMap.set(caseGroup.childItemIds[0], caseGroup)
})
// delete removed items
const itemsToValidate = new Set<string>(self.itemInfoMap.keys())
self._itemIds.forEach(itemId => itemsToValidate.delete(itemId))
// delete removed items from selection
itemsToValidate.forEach(itemId => {
self.itemInfoMap.delete(itemId)
// update selection
self.selection.delete(itemId)
})
Expand Down

0 comments on commit ca9fa2e

Please sign in to comment.