pardom
10/10/2016, 8:50 PMpardom
10/10/2016, 8:50 PMgnardini
10/10/2016, 8:50 PMpardom
10/10/2016, 8:55 PMShowToast(val text: String)
that would copy a toastText: String
value to the state.pardom
10/10/2016, 8:55 PMtoastText
.pardom
10/10/2016, 8:56 PMShowToast
actions.pardom
10/10/2016, 8:57 PMpardom
10/10/2016, 8:57 PMpardom
10/10/2016, 8:58 PMNavigationService
and NavigationFactory
pardom
10/10/2016, 8:58 PMGoBack
action, my custom middleware will call navigationService.goBack()
pardom
10/10/2016, 8:59 PMNavigationService
.pardom
10/10/2016, 8:59 PMToastPresenter
which does the samepardom
10/10/2016, 9:04 PMgnardini
10/10/2016, 9:56 PMtoastMessage
from the state on every reduce call isn’t ideal either. I’ll give it a try and see how it works out, thanks!pardom
10/10/2016, 10:22 PMgnardini
10/10/2016, 10:24 PMpardom
10/10/2016, 10:27 PMkittinunf
01/03/2017, 3:10 AMmesquka
04/26/2017, 2:24 PMArchie
07/29/2020, 1:36 PMAppState
? Examples I've seen so far only show a small application where the AppState
is very simple. But how do you model an AppState
in a Large Application with multiple screens? Do I make smaller "`AppState`" inside the "root" AppState
like:
data class AppState(
val loginAppState: LoginAppState,
val signUpAppState: SignUpAppState
val someOtherScreenAppState: OtherScreenAppState
....
)
data class LoginAppState(
val usernamer: String,
val password: String
....
)
I'd really appreciate any help. Thank you very much in advanceDavide C
03/31/2021, 11:00 AMStefan Oltmann
07/27/2021, 6:51 AMWilliam Persall
09/02/2021, 9:25 PMtype alias Reducer<S,A> = (S,A) -> S
When I create function that looks like fun myfun(State:SomeStateClass, action:Action):SomeStateClass
Then I get a mismatch type error on myFun when entered as below.
val store = createStore(myFun(), SomeStateClass())
is this a know issue, or is there a workaround?William Persall
09/17/2021, 2:29 PMAlexander Black
01/08/2022, 12:59 AMoverride fun invoke(store: Store<AppState>): (next: Dispatcher) -> (action: Any) -> Any {
return { next ->
{ action ->
if (action is Request) coroutineScope.launch {
action.execute(store.getState, store.dispatch, api, db)
}
next(action)
}
}
}
which just dispatches async requests on its own coroutineScope which is very useful for making API/DB fetches, but the problem I run into from time to time is if I want to update the store state and then dispatch another action from within an action sometimes the state updating action gets executed after the next request action, which might depend on the state being updated. Maybe my approach is wrong, but that's kinda what I'm struggling with.
example usecase:
BootAppRequest:
step one: get the logged in user data from the db
step two: update the store with the user data
step three: This step is new dispatched action. request some other user data from API which depends on user data being in the store.
as you can see from the usecase above the sequence of actions is important. I could execute step three in a function, but it's being used in several places in the UI and for good code reusability it makes more sense to be a dispatched action.
I really want the request action to get handled on a background thread so I don't potentially impact the UI thread
Anyway any advice would be helpful.Jasin Colegrove
03/12/2022, 6:17 PMClaude Brisson
03/24/2023, 7:03 AMWilliam Persall
05/12/2023, 6:22 PMwillyrs
02/09/2024, 5:05 PM