When you return Ok(vec![]) from an aggregate's handle() function, the aggregate's queries are being executed even though there are no events to be dispatched. You could argue that it is the query's responsibility to ignore an empty list of events, but the current implementation of GenericQuery does not do that and will instead always load a view, increment its version and save it whenever the query's dispatch() function is called, irrespective of its inputs.
I think it makes sense to change the behavior of CqrsFramework, so that it doesn't propagate any empty event lists coming from the aggregate's handle() function.
When you return
Ok(vec![])
from an aggregate'shandle()
function, the aggregate's queries are being executed even though there are no events to be dispatched. You could argue that it is the query's responsibility to ignore an empty list of events, but the current implementation ofGenericQuery
does not do that and will instead always load a view, increment its version and save it whenever the query'sdispatch()
function is called, irrespective of its inputs.I think it makes sense to change the behavior of
CqrsFramework
, so that it doesn't propagate any empty event lists coming from the aggregate'shandle()
function.