-
Notifications
You must be signed in to change notification settings - Fork 47
Always remove child view controller from DescribedViewController #115
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
Conversation
| XCTAssertFalse(describedViewController.isViewLoaded) | ||
| XCTAssertFalse(describedViewController.currentViewController.isViewLoaded) | ||
| XCTAssertNil(describedViewController.currentViewController.parent) | ||
| XCTAssertEqual(describedViewController.currentViewController.parent, describedViewController) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually do want this child-parent relationship set up, which is also fixed
|
|
||
| // Then | ||
| XCTAssertNotEqual(initialChildViewController, describedViewController.currentViewController) | ||
| XCTAssertNil(initialChildViewController.parent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test validates the fix. It fails on main.
dhavalshreyas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
n8chur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing!
Fixes an issue where the child of a
DescribedViewControllerwasn't removed even when thecurrentViewControllerwas replaced. This issue was introduced in #108 - we started setting up the parent-child relationship in the init, but only remove the child if our view is loaded. In the case where an update happens before the view is loaded, that initial child is never removed.The left-behind relationship and view was causing issues where (correct) assumptions about the view and view controller hierarchy were invalid, causing this crash: https://square.slack.com/archives/CTJ4UNLHF/p1641510705024100
Thanks @tyten and @kyleve for helping debug!
Checklist