Open MafcoCinco opened 4 years ago
@SVMBrown fixed the issue by allowing the events to be executed multiple times. This will impact cases where event functions aren't pure, but that's not a supported or encourage use case at the moment. https://github.com/domino-clj/domino/commit/221fad440cb99e6e41b1431d383f1374089fab98
In certain dependency configurations, events are not triggered properly. The below example is a simple schema that replicates the bug:
When the above schema is initialized and a transaction is executed with the following input:
there will be a
NullPointerExecption
. Furthermore, even if the second event handler is implemented to account for the fact that it could be called with anil
value ofc
, the correct output is never actually obtained as the handler is not invoked a second time when thedb
is updated with a new value forc
(from the first event).This highlights 3 issues:
The documentation should be updated, provided it does not already contain this information, to indicate that event handlers can be called with partial input. Users should not assume that all data is populated and they may receive some
nil
valuesThe event processing code should be fixed such that the handler for the second event is invoked a second time when a new value of
c
is placed into thedb
as a result of executing the first eventnil
values should be stripped out of the input to event handlers in order to keep destructuring working correctly. The above schema causes aNullPointerException
even though it contains an:or {c 0}
. The reason for this is the input to the handler contains the key:c
which has a value ofnil
. As such, the:or ...
is not evaluated during destructuring andc
retains a value ofnil
.