Yes, another reader pointed out that stateIn() actually always restarts the coroutine which collects the upstream Flow even if it reaches completion, unlike the LiveData coroutine builder. I need to update the article to correct that.
I haven’t seen your recommended solution on Reddit so I can’t comment on that. RepeatOnLifecycle() works just as well as asLiveData() to cancel long-running flows when the activity stops. Both won’t prevent the upstream Flow to restart from scratch when the activity becomes visible again though. You can mitigate that by saving some state that you read when the Flow starts so you can pick up where you left off.