[MVI] intent(MviView::intent) does't fire before view is attached
See original GitHub issueMy question is somehow similar to this #242 So I have an intent in my view implemented like this:
override fun selectDateIntent(): Observable<Day> {
return selectDatePubSub.distinctUntilChanged()
.startWith(selectedDate)
.doOnNext {
//this fires one time correctly because off startWith()
}
}
In the presenter I have this observable wrapped in the intent() function like this:
timetableInteractor.setSelectDateIntent(intent(TimetableView::selectDateIntent)} )
After debugging I noticed that the observable resulting from the wrapped intent does not emit nothing before the view is attached. So, if I add a delay to the intent implementation in the view, everything goes as expected. However, in the MVI sample code having Observable.just(object) is a recurring practice for the intent implementations, so I am curious to know what I’m doing incorrectly.
Thanks, Diogo
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Android MVI (Model-View-Intent) Architecture — Example code
MVI stands for Model-View-Intent but this word “intent” doesn't refers to the Android Intents that we know. Let's breakdown the main 3 layers....
Read more >Reactive Apps with Model-View-Intent - Part 2
Model-View-Intent MVI on Android by using Mosby 3. ... Before we start to connect the dots lets quickly discuss the main idea of...
Read more >LiveData vs SharedFlow and StateFlow in MVVM and MVI ...
MVI stands for Model–View–Intent and it's a design pattern that ... We have SharedFlow, StateFlow, but we had Flow already in Kotlin before....
Read more >Why MVI? Model View Intent -- The curious case of ... - YouTube
In this talk:- We will learn about the main problem that this pattern solves - The State Problem, What it is and how...
Read more >Building An Android App With MVI - YouTube
Broadcasted live on Twitch -- Watch live at https://www.twitch.tv/adammc331You can find the source code here: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Binding intents actually starts in attachView method of MviBasePresenter. In MviActivity this method calls in onStart. So if you use PublishSubject item could be emitted before this time because it is a hot observable. If you use Observable.just(…) we don’t have this problem. In this situation i use BehaviorSubject instead of PublishSubject.
But if you call startWith inside intent() function it should work ok. So this is issue is the same as #242 as far as i concern
I will work on that next week
jhowens89 notifications@github.com schrieb am Fr., 23. Feb. 2018, 01:51: