Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public async Task<Result<TState>> Handle<TCommand>(TCommand command, Cancellatio
var result = (await registeredHandler.Handler(loadedState.State, loadedState.Events, command, cancellationToken).NoContext()).ToArray();

var newEvents = result.Select(x => new ProposedEvent(x, new())).ToArray();
var newState = newEvents.Aggregate(loadedState.State, (current, evt) => current.When(evt));
var newState = newEvents.Aggregate(loadedState.State, (current, evt) => current.When(evt.Data));

// Zero in the global position would mean nothing, so the receiver needs to check the Changes.Length
if (newEvents.Length == 0) return Result<TState>.FromSuccess(newState, Array.Empty<Change>(), 0);
Expand Down