Skip to content

Commit

Permalink
fix: parent mismatch when deleting elements
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Mar 11, 2024
1 parent 95d106f commit 853a051
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/uikit/src/flex/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,18 @@ export class FlexNode implements WithImmediateProperties {
if (groupChildren == null) {
return 0
}
const i1 = groupChildren.indexOf(child1.groupRef.current as any)
const group1 = child1.groupRef.current
const group2 = child2.groupRef.current
if (group1 == null || group2 == null) {
return 0
}
const i1 = groupChildren.indexOf(group1)
if (i1 === -1) {
throw new Error(
`${child1.groupRef.current} doesnt have the same parent as ${this.children[0].groupRef.current}`,
)
throw new Error(`parent mismatch`)
}
const i2 = groupChildren.indexOf(child2.groupRef.current as any)
const i2 = groupChildren.indexOf(group2)
if (i2 === -1) {
throw new Error(
`${child2.groupRef.current} doesnt have the same parent as ${this.children[0].groupRef.current}`,
)
throw new Error(`parent mismatch`)
}
return i1 - i2
})
Expand Down

0 comments on commit 853a051

Please sign in to comment.