Fix onEffects not called when subscriptions are removed #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
onEffects()
function is not called ifProgram.subscription()
returnsundefined
. This causes problems becuse the previous call may have returned a subscription and that caused a call toonEffects()
which then did setup some subscription. Then the program is no longer interested in the subscription so it returnsundefined
fromProgram.subscription()
. Now the effect manager should terminate the underlying subscription but sinceonEffects()
is not called it does not.The problematic code is here. It is an attempt at optimizing the calls to
onEffects()
and only call the effect managers that actually has gathered effects. This works well forCmd
becuase in that caseundefined
means there is no command to execute. However for subscriptionsundefined
means the program wants no subscriptions which is significant if the program previously wanted subscriptions.This line only calls effect managers that has gathered effects. This PR will change to all effect managers are always called and the ones that does not have any Cmd or Sub will recieve
undefined
on those parameters.