-
Notifications
You must be signed in to change notification settings - Fork 841
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
[SOLVED?] sample-mvi
crashes on Start
#314
Comments
Here is the change i made to fix this problem: Subject<I> intentRelay = ReplaySubject.create();
//Subject<I> intentRelay = UnicastSubject.create(); this was inserted on 513d1e9 ("use unicast subject", 2018-04-08) |
sample-mvi
crashes on Startsample-mvi
crashes on Start
Sorry for the long delay. I'm quite busy at the moment, I will take a look at this at the end of July. |
When I upgrade mosby library from 3.1.0 to 3.1.1 I faced with this problem too. |
Maybe UnicastSubject conflicts with the navigation feature, |
Im facing this problem in my app, i tried with ReplaySubject but it doesn't work. |
What exactly is the issue that you face in your app?
Simon <[email protected]> schrieb am Do., 30. Mai 2019, 12:34:
… Im facing this problem in my app, i tried with ReplaySubject but it
doesn't work.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#314?email_source=notifications&email_token=AAEOPLSY7KK4YJEL66G4CWTPX6UUPA5CNFSM4FB6S7PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWR7VPY#issuecomment-497285823>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEOPLUG3OADVNMS3BVWNGLPX6UUPANCNFSM4FB6S7PA>
.
|
Here is my stack trace
And here is my base presenter class abstract class BasePresenter<TView : BaseView<TViewState>, TViewState: ViewState>(viewState: TViewState)
: MviBasePresenter<TView, TViewState>(viewState) {
protected val initialState: TViewState = viewState
private var viewStateSnapshot: TViewState = viewState
protected val lastViewState: TViewState
get() = viewStateSnapshot
override fun attachView(view: TView) {
super.attachView(view)
view.render(viewStateSnapshot)
}
override fun subscribeViewState(viewStateObservable: Observable<TViewState>, consumer: ViewStateConsumer<TView, TViewState>) {
val viewStateStream = if(BuildConfig.DEBUG){
viewStateObservable
} else {
viewStateObservable.map { it as ViewState }
.onErrorReturn {
FailureViewState()
}.filter { it !is FailureViewState }
.map { it as TViewState }
}
super.subscribeViewState(viewStateStream) { view, viewState ->
this.viewStateSnapshot = viewState
consumer.accept(view, viewState)
}
}
private class FailureViewState: ViewState()
} After changing Unicast to Relay (as ValeriusGC suggest) state is not beeing updated anymore. |
Oh ... i see, thanks for reporting! I have to think about it. It seems I
have to write something custom to handle this cases ...
Simon <[email protected]> schrieb am Sa., 1. Juni 2019, 16:28:
… Here is my stack trace
java.lang.IllegalStateException: ViewState observable must not reach error state - onError()
at com.hannesdorfmann.mosby3.mvi.DisposableViewStateObserver.onError(DisposableViewStateObserver.java:22)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.checkTerminated(ObservableObserveOn.java:281)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:172)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:119)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.IllegalStateException: Only a single observer allowed.
at io.reactivex.subjects.UnicastSubject.subscribeActual(UnicastSubject.java:311)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableDoOnEach.subscribeActual(ObservableDoOnEach.java:42)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableSwitchMap.subscribeActual(ObservableSwitchMap.java:51)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:165)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
at io.reactivex.internal.operators.observable.ObservableFromArray$FromArrayDisposable.run(ObservableFromArray.java:108)
at io.reactivex.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:37)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:165)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
at io.reactivex.internal.operators.observable.ObservableFromArray$FromArrayDisposable.run(ObservableFromArray.java:108)
at io.reactivex.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:37)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableDoOnEach.subscribeActual(ObservableDoOnEach.java:42)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableScanSeed.subscribeActual(ObservableScanSeed.java:47)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableDoOnEach.subscribeActual(ObservableDoOnEach.java:42)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableDistinctUntilChanged.subscribeActual(ObservableDistinctUntilChanged.java:35)
at io.reactivex.Observable.subscribe(Observable.java:12090)
And here is my base presenter class
abstract class BasePresenter<TView : BaseView<TViewState>, TViewState: ViewState>(viewState: TViewState)
: MviBasePresenter<TView, TViewState>(viewState) {
protected val initialState: TViewState = viewState
private var viewStateSnapshot: TViewState = viewState
protected val lastViewState: TViewState
get() = viewStateSnapshot
override fun attachView(view: TView) {
super.attachView(view)
view.render(viewStateSnapshot)
}
override fun subscribeViewState(viewStateObservable: Observable<TViewState>, consumer: ViewStateConsumer<TView, TViewState>) {
val viewStateStream = if(BuildConfig.DEBUG){
viewStateObservable
} else {
viewStateObservable.map { it as ViewState }
.onErrorReturn {
FailureViewState()
}.filter { it !is FailureViewState }
.map { it as TViewState }
}
super.subscribeViewState(viewStateStream) { view, viewState ->
this.viewStateSnapshot = viewState
consumer.accept(view, viewState)
}
}
private class FailureViewState: ViewState()
}
After changing Unicast to Relay (as ValeriusGC suggest) state is not
beeing updated anymore.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#314?email_source=notifications&email_token=AAEOPLXML25TJBALTEUBZOTPYKBQDA5CNFSM4FB6S7PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWXBVXQ#issuecomment-497949406>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEOPLQRLI7ZGXQBMQRAS5DPYKBQDANCNFSM4FB6S7PA>
.
|
When can I expect a fix? It is critical for my app because i cannot update to AndroidX |
Not before next week
Simon <[email protected]> schrieb am Mo., 3. Juni 2019, 10:16:
… When can I expect a fix? It is critical for my app because i cannot update
to AndroidX
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#314?email_source=notifications&email_token=AAEOPLTHAXDGMS6KLKBVEVTPYTHPNA5CNFSM4FB6S7PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWYU2KA#issuecomment-498158888>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEOPLVTVQDUL7NOZYE4L7DPYTHPNANCNFSM4FB6S7PA>
.
|
What is the status of this case? |
@sockeqwe any news? when it will be fixed? |
No update yet sorry. Do you have custom subscription management somewhere
in your presenter?
Michal <[email protected]> schrieb am Mo., 15. Juli 2019, 14:18:
… @sockeqwe <https://github.com/sockeqwe> any news? when it will be fixed?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#314?email_source=notifications&email_token=AAEOPLSQJU3KLNH4DP76MOLP7RTKDA5CNFSM4FB6S7PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ5QLFA#issuecomment-511378836>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEOPLTSP6ZS46IGJQC5NFTP7RTKDANCNFSM4FB6S7PA>
.
|
@sockeqwe any update on the fix? I also got the same problem using AndroidX with version 3.1.1 |
need to dedicate 1-2 weeks for it, not sure when I will have time for it
Sun Maung Oo <[email protected]> schrieb am Mi., 18. Sep. 2019,
01:03:
… @sockeqwe <https://github.com/sockeqwe> any update on the fix? I also got
the same problem using AndroidX with version 3.1.1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#314?email_source=notifications&email_token=AAEOPLXUHAGLEC77BPG3NJDQKFO2ZA5CNFSM4FB6S7PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD66E55Y#issuecomment-532434679>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEOPLSSRHTES5TIXGJRZCTQKFO2ZANCNFSM4FB6S7PA>
.
|
@sockeqwe Just for your information , the solution provided by ValeriusGC which is changing it to ReplaySubject fix the problem. I don't know what effect it will have on other components but it fix the problem described. |
Wish this had a solution..... |
When i start it on Android Studio 3.1.2, app crashes with stack like this:
The text was updated successfully, but these errors were encountered: