Skip to content

Commit

Permalink
fix: Missed case for component modified (after being set) event for e…
Browse files Browse the repository at this point in the history
…xtends fix
  • Loading branch information
0ffz committed Mar 23, 2024
1 parent ba09022 commit d35be6f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class Archetype internal constructor(
val addIndex = indexOf(dataComponent)
if (addIndex != -1) {
componentData[addIndex][row] = data
if (callEvent) callComponentModifyEvent(geary.components.updatedComponent, row, componentId)
if (callEvent) callComponentModifyEvent(geary.components.updatedComponent, row, componentId, onUpdated)
return
}

Expand Down Expand Up @@ -325,6 +325,7 @@ class Archetype internal constructor(
callEvent: Boolean = true,
) {
val baseEntity = this.getEntity(baseRow)
val instanceEntity = instanceArch.getEntity(instanceRow)
var instanceArch = instanceArch
var instanceRow = instanceRow
instanceArch.addComponent(instanceRow, Relation.of<InstanceOf?>(baseEntity).id, true) { arch, row ->
Expand All @@ -342,8 +343,10 @@ class Archetype internal constructor(
}
}
baseEntity.children.fastForEach {
it.addParent(instanceArch.getEntity(instanceRow))
it.addParent(instanceEntity)
}
records.runOn(instanceEntity) { arch, row -> instanceArch = arch; instanceRow = row }

if (callEvent) instanceArch.callComponentModifyEvent(
geary.components.extendedEntity,
instanceRow,
Expand Down

0 comments on commit d35be6f

Please sign in to comment.