tokopedia / RxComposableArchitecture

RxComposableArchitecture is a forked of Composable Architecture with adjustment to make it work with UIKit.
Apache License 2.0
31 stars 5 forks source link

Tie Effects Lifetime to The Lifetime of the Store #58

Closed vctxr closed 1 year ago

vctxr commented 1 year ago
BEFORE AFTER
https://user-images.githubusercontent.com/62132009/193533270-28eff156-104b-4f6f-b697-b46f86ac2bea.mp4 https://user-images.githubusercontent.com/62132009/193533292-8e62aeae-eac8-4c64-a862-842ae88b51e7.mp4

What

Currently, effects will not automatically be cancelled on store's deinit causing long running effects to still be running indefinitely. This is because of the nature of CompositeDisposable where it does not automatically dispose of it's disposables on deinit (like a regular dispose bag).

How

To solve the issue, we need to tie the lifecycle of the composite disposable to the dispose bag or we could also manually call compositeDisposable.dispose() on deinit.