Skip to content

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.

3 participants