Skip to content

fix: Idempotent start#25

Open
plajdo wants to merge 3 commits into
GoodRequest:mainfrom
plajdo:fix/idempotent-start
Open

fix: Idempotent start#25
plajdo wants to merge 3 commits into
GoodRequest:mainfrom
plajdo:fix/idempotent-start

Conversation

@plajdo

@plajdo plajdo commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Added check whether any subscriptions for current Reactor are active. This makes start function idempotent for callers, and effectively prevents creating duplicate subscriptions.

Condition: transform function must be free of side effects, as empty transform will be called multiple times, until first subscription is created for the Reactor.


Disabled auto-start of AnyReactor type-erased type.
Previously this auto-start behaviour caused incorrectly stored Combine/non-combine subscriptions to external events from viewModels. Subscriptions were being stored under the wrapper type, which caused confusion and non-clear event routing.

Added tests to verify.


Effects:

Call to viewModel.start() now has to be explicit and will always be forwarded to correct concrete Reactor type.

@plajdo plajdo mentioned this pull request Jul 1, 2026
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.

1 participant