terrakok / Cicerone

🚦 Cicerone is a lightweight library that makes the navigation in an Android app easy.
Other
2.58k stars 218 forks source link

SupportFragmentNavigator.BackToRoot only pops one fragment off the backstack #79

Closed wispborne closed 6 years ago

wispborne commented 6 years ago

SupportFragmentNavigator

    private void backToRoot() {
        fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        localStackCopy.clear();
    }

Shouldn't this pop all fragments off the backstack until we reach the root? Currently, it only pops the top one.

As a result, the following navigation happens: On: A Navigate: Forward to B On: B Navigate: newScreenChain starting with A On: A Navigate: Back On: B <--- what?! But we called newScreenChain!

wispborne commented 6 years ago

There doesn't appear to be a bug, after all. There was a bug in my code and BackTo(null) was not getting called, but I thought it was. Now that I've fixed my own bug, Cicerone works as I'd expected it to.

Thanks for the great and flexible library!