Hello everyone. I am having a problem with navigat...
# decompose
f
Hello everyone. I am having a problem with navigation between two components (well, the problem is not related with navigation but with management of their lifecycles). I am using
Child Stack Navigation
with two configurations :
A
and
B
. The configuration
A
has a store which load data from repository with onAction. The user can navigate to configuration B
"navigate.push(Configuration.B)"
. The user also can navigate back to configuration A
"navigate.pop()"
. So the stack is in this way : User opens the application : [A*] (data loaded from repository) User navigates to configuration B : [A, B*] (navigate.push(Configuration.B)) User goes back to configuration A : [A] (navigation.pop()) When the user goes back to configuration A the data is not loaded from repository again because the onAction is not called once the store was not destroyed. I thought to remove the data load of the onAction and creating a Intent for that. And calling that Intent in
lifecycle.onStart()
of component of Configuration.A. My question: is it correct that approach??? Are there a way simpler to make that???
a
That looks valid. Intent.Refresh should work.
f
ok arkadii. One suggestion : when create the Store add the possibility to choose what method (onCreate, onStart, onResume) trigger the onAction . What do you think??
a
What kind of Action? If it's MVIKotlin, then Actions are produced by the Bootstrapper.
f
yes, action of the Bootstrapper
a
Bootstrapper by definition runs only once. The easiest solution is to add an explicit Intent.Refresh.
f
I got, so ok. tks