diff --git a/application/src/commonMain/kotlin/com/fraktalio/fmodel/application/EventSourcingAggregate.kt b/application/src/commonMain/kotlin/com/fraktalio/fmodel/application/EventSourcingAggregate.kt index 2be1d93..02dfd59 100644 --- a/application/src/commonMain/kotlin/com/fraktalio/fmodel/application/EventSourcingAggregate.kt +++ b/application/src/commonMain/kotlin/com/fraktalio/fmodel/application/EventSourcingAggregate.kt @@ -45,7 +45,8 @@ interface EventOrchestratingComputation : ISaga, IDecider - val newEvents = flowOf(fetchEvents(c), resultingEvents) + val previousEvents = resultingEvents.toList().asFlow() + val newEvents = flowOf(fetchEvents(c), previousEvents) .flattenConcat() .computeNewEventsByOrchestrating(c, fetchEvents) resultingEvents = flowOf(resultingEvents, newEvents).flattenConcat()