Zhuinden / simple-stack

[ACTIVE] Simple Stack, a backstack library / navigation framework for simpler navigation and state management (for fragments, views, or whatevers).
Apache License 2.0
1.36k stars 76 forks source link

Treat back operation as terminal, and immediately enqueued other navs should be ignored #197

Closed Zhuinden closed 4 years ago

Zhuinden commented 4 years ago

Currently it is possible to send in such invalid input that while navigating back, you also try navigating forward. This can create an invalid navigation history, which breaks the reliance on implicit scoping.

So by mashing the right buttons, you can do either:

[A, B] -> [A, B, C]

or

[A, B] -> [A] -> [A, C]

If you use implicit scopes, lookups from C will fail.


After a very long consideration, the enqueue logic of reentrancy should ignore additional navigation actions during a back navigation, potentially triggered by jumpToRoot and goBack.

Zhuinden commented 4 years ago

I still think this is actually breaking, so I'm delaying it.

But this still bothers me.

Zhuinden commented 4 years ago

The PR managed to keep all test in-tact, wow.

But with certain limitations, such as replaceTop for example is also technically "back/forward" but not considered "terminal".

This change needs more testing in a real environment.

Zhuinden commented 4 years ago

replaceTop is now terminal.

Zhuinden commented 4 years ago

Seems to be working as intended. I should have done this sooner.