-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Section Controller Incorrect Index #709
Comments
@amonshiz you had a unit test that failed for this, right? Can you paste the test in here? |
what's the status here? anyone working on this? |
yeah sorry, the current implementation at least maintains the last known section index correctly. |
@rnystrom here is a link to the test that will demonstrate the issue: https://github.com/Instagram/IGListKit/blob/master/Tests/IGListAdapterTests.m#L1190-L1215 and here is a version of that test converted to work for code before a4e5ad8:
With the current implementation (using the property) the second to last assert will not fire because the property does not update when a list adapter is deallocated. prior to that change that assert would fail because the |
New issue checklist
README
and documentationGeneral information
IGListKit
version: <3.0.0Debug information
This required only maintaining a reference to a section controller beyond the time when its owning list adapter was deallocated. In this situation the section controller would be retained but the list adapter not (
weak
property) and so a[sc.collectionContext sectionForSectionController:sc]
would return 0 due tonil
messaging.Thankfully #671 addressed part of this issue. Now, because the value of the index is stored in the
sectionIndex
property that value will at least represent the last known correct value. In situations where the section controller was never added to the list adapter's section map then the value will beNSNotFound
.However, that does not really address the overall issue of a section controller having an index after the list adapter, and thus all list context, being deallocated. In those situations I propose that the
sectionIndex
for all existing section controllers be reset toNSNotFound
in thedealloc
method of theIGListSectionMap
object.The text was updated successfully, but these errors were encountered: