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

Track VCs being popped from stack from UIKit #243

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

stephencelis
Copy link
Member

Tapping the back button or interactively popping via gesture can conflict with observation when the view controller being popped to executes a mutation in its will- or didAppear. While this isn't common in vanilla UIKit, in TCA sending even a no-op action in these lifecycle hooks can lead to immediately re-pushing the view controller that was just popped.

This commit does what it can to detect when the back button was pushed or the interactive pop gesture was invoked so that if/when the pop is committed, we can update the path more eagerly, avoiding the re-presentation.

Tapping the back button or interactively popping via gesture can
conflict with observation when the view controller being popped to
executes a mutation in its `will`- or `didAppear`. While this isn't
common in vanilla UIKit, in TCA sending even a no-op action in these
lifecycle hooks can lead to immediately re-pushing the view controller
that was just popped.

This commit does what it can to detect when the back button was pushed
or the interactive pop gesture was invoked so that if/when the pop is
committed, we can update the path more eagerly, avoiding the
re-presentation.
@stephencelis
Copy link
Member Author

@mbrandonw Would be nice to write some tests for this but not sure how easy it will be given:

  1. I think it requires the path live in some other observable state in TCA
  2. Unit testing against the back button being pressed, or the interactive pop gesture, seems maybe possible, but could be tricky to do so in a real-world kind of way

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

Successfully merging this pull request may close these issues.

1 participant