Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New way to break Flow.goBack() #264

Open
dcow opened this issue Jun 13, 2017 · 3 comments
Open

New way to break Flow.goBack() #264

dcow opened this issue Jun 13, 2017 · 3 comments

Comments

@dcow
Copy link
Contributor

dcow commented Jun 13, 2017

I have encountered an issue where the history size shrinks while a traversal is in-flight. This could happen any time you hold traversals while you're switching screens (perhaps for an animation) and mash the back button quickly. It appears the issue is noted:

8a9325b#diff-0351f5577272525804cf0292acb7fe1bR283

#195 #240

but I don't think the solution of simply noop-ing the traversal is entirely correct. When this happens, the dispatcher never gets to execute the next pending traversal. It may be a good idea to noop the traversal, but the dispatcher still needs to flush traversals so that the whole thing doesn't grind to a halt. Another option might be to continue dispatching the traversals but not pop the history if Flow notices the history has changed size.

A workaround is to not hold onto traversals, but that's not really what you want to do long term.

@Zhuinden
Copy link

So I'm guessing the problem is that it does a return; and not an immediate onTraversalCompleted() (which wouldn't work because it's not technically "dispatched"), and therefore somehow you can enqueue ops after the enqueued goBack() but it is not started because of return; instead of starting the next enqueued traversal if possible?

pendingTraversal = next;
if (pendingTraversal == null) {
final Iterator<Object> it = tearDownKeys.iterator();
while (it.hasNext()) {
keyManager.tearDown(it.next());
it.remove();
}
keyManager.clearStatesExcept(history.asList());
} else if (dispatcher != null) {
pendingTraversal.execute();

@Zhuinden
Copy link

Zhuinden commented Jul 11, 2017

Have you figured out if my hunch was right or wrong? I mean, I haven't used Flow in a while.

@sdelaysam
Copy link

@dcow here how I solved the issue for me
sdelaysam@4980cef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants