From b319835e4b1017e04f3b792959c905d38cc06977 Mon Sep 17 00:00:00 2001 From: Ivan Dugalic Date: Fri, 17 May 2024 19:48:50 +0200 Subject: [PATCH] Application module: Fixing bug in event computation - orchestrated scenario --- .../com/fraktalio/fmodel/application/EventSourcingAggregate.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 2be1d930..02dfd59d 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()