Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional callbacks to the collectLatest and combineLatestUpdates #51

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

bvdmitri
Copy link
Member

This PR adds a new optional callbackFn argument for collectLatest and combineLatestUpdates, which allows to call a custom function upon each execution of the collected/combined event. This is a hot-fix for a bug found in ReactiveMP.

@bvdmitri bvdmitri requested a review from wouterwln April 10, 2024 14:15
@@ -94,7 +100,11 @@ function next_received!(wrapper::CollectLatestObservableWrapper, data, index::Ca
@inbounds wrapper.ustatus[index] = true
if all(wrapper.vstatus) && !all(wrapper.cstatus)
unsafe_copyto!(wrapper.vstatus, 1, wrapper.cstatus, 1, length(wrapper.vstatus))
next!(wrapper.actor, wrapper.mappingFn(wrapper.storage))
value = wrapper.mappingFn(wrapper.storage)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to parameterize CollectLatestObservableWrapper here? I think it will compile away the call to isnothing if {C} is nothing already

Copy link
Member Author

@bvdmitri bvdmitri Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is parametrized with C already

Copy link
Member

@wouterwln wouterwln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from this one comment that I'm not sure about could improve type stability looks fine to me

@bvdmitri bvdmitri merged commit 9191753 into main Apr 10, 2024
10 checks passed
@bvdmitri bvdmitri deleted the dev-combination-callbacks branch April 11, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants