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

broadcastIn's ReplaceWith is incorrect #2344

Closed
ansman opened this issue Oct 28, 2020 · 0 comments
Closed

broadcastIn's ReplaceWith is incorrect #2344

ansman opened this issue Oct 28, 2020 · 0 comments
Labels

Comments

@ansman
Copy link
Contributor

ansman commented Oct 28, 2020

I tried using the ReplaceWith for broadcastIn in 1.4.0 and it has several issues.

Firstly it doesn't handle CoroutineStart other than lazily which seems a bit dangerous as it might change behavior.

Secondly the order of the parameters is incorrect. In the ReplaceWith it's listed as shareIn(scope, 0, SharingStarted.Lazily) while the final version of shareIn has scope, started, replay.

Lastly it was just broken:

someFlow
  .broadcastIn(viewModelScope)
// became
run {
  flow
  shareIn<Type>(viewModelScope, 0, SharingStarted.Lazily)
}

One solution would be to add a deprecated, single argument, overload for broadcastIn which is replaced with shareIn(scope) and the 2 argument overload can have its ReplaceWith removed since it cannot be done reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants