Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Fix a recycling bug that purges indirect subviews #243

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Biinngg
Copy link

@Biinngg Biinngg commented Nov 1, 2018

Only walk first level of subviews that are created by LayoutKit.
If a subview isn't created by LayoutKit, then there is no need to walk
subviews of it, as they must not be created by this layout.

Only walk first level of subviews that are created by LayoutKit.
If a subview isn't created by LayoutKit, then there is no need to walk
subviews of it, as they must not be created by this layout.
@staguer
Copy link
Contributor

staguer commented Nov 1, 2018

Oh, this looks like a good improvement, thanks!

I have a couple of points:

  1. This avoids traversing rootView -> nonLayoutKitView -> otherLayoutKitViews, right? What if we had rootView -> LayoutKitView -> nonLayoutKitView -> otherLayoutKitViews? Perhaps we should do this check at every level?
  2. Do we need to check $0.isLayoutKitView || $0.viewReuseId != nil or is it sufficient to just check $0.isLayoutKitView?
  3. I liked your comment at the start of this Pull Request here, can you please add the comment to the code as well, explaining why it’s important to have the check and what problem it avoids?

Thank you!

Fix test failures in ViewRecyclerTests.
Add comments for the change.
@Biinngg
Copy link
Author

Biinngg commented Nov 2, 2018

Hi Sergei, Thanks for your review. Your points sound good. I updated my PR to include those changes. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants