Closed bejibx closed 7 years ago
Great find! Unfortunately calling executePendingTransactions()
here may have unintended side-effects for developers who use Fragments for other things, as it would execute all pending transactions, not just this one (ugh, fragments...). The fix for this will be a little more involved, but it should be doable.
Unfortunately calling executePendingTransactions() here may have unintended side-effects for developers who use Fragments for other things
I'm agree with that, thats just the only reliable way which came to my mind. Curious how are you planning to solve this without using executePendingTransactions()
?
I'm not sure yet. If nothing else we can keep a Map<Activity, LifecycleHandler>
that removes entries when activities get destroyed to prevent memory leaks.
I ultimately settled on using the Map idea, which isn't awesome, but seemed to be the only thing that worked without interfering with other things the developer may be doing. Should be fixed in the latest snapshot.
Hi! I was playing with
Conductor
in small test project and notice strange behaviour when adding multiple routers inActivity#onCreate(Bundle)
method:And here is log on first screen rotate:
As you can see, first controller is created again. This happens because the way
LifecycleListener
gets installed intoActivity
:FragmentTransaction#commit()
is asynchronous operation, so during second router attach it's not yet added toActivity
which causes multipleLifecycleListener
instances being created.For now to workaround this I'm calling
FragmentManager#executePendingTransactions()
after first router attach:But I think this method should be called inside
LifecycleListener#install(Activity)
.