{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/componentkit/issues/327","labels_url":"https://api.github.com/repos/facebook/componentkit/issues/327/labels{/name}","comments_url":"https://api.github.com/repos/facebook/componentkit/issues/327/comments","events_url":"https://api.github.com/repos/facebook/componentkit/issues/327/events","html_url":"https://github.com/facebook/componentkit/issues/327","id":97884386,"number":327,"title":"Bug: advanced view of subcomponent gets remounted in random collection view cells","user":{"login":"leoschweizer","id":428354,"avatar_url":"https://avatars.githubusercontent.com/u/428354?v=3","gravatar_id":"","url":"https://api.github.com/users/leoschweizer","html_url":"https://github.com/leoschweizer","followers_url":"https://api.github.com/users/leoschweizer/followers","following_url":"https://api.github.com/users/leoschweizer/following{/other_user}","gists_url":"https://api.github.com/users/leoschweizer/gists{/gist_id}","starred_url":"https://api.github.com/users/leoschweizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leoschweizer/subscriptions","organizations_url":"https://api.github.com/users/leoschweizer/orgs","repos_url":"https://api.github.com/users/leoschweizer/repos","events_url":"https://api.github.com/users/leoschweizer/events{/privacy}","received_events_url":"https://api.github.com/users/leoschweizer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-29T08:19:19Z","updated_at":"2015-09-21T12:37:43Z","closed_at":null,"body":"Note: I'm using the 0.12 release, not :head!\r\n\r\nI have a component which creates a view according to the \"advanced views\" section of the docs:\r\n\r\n```objc\r\nstatic UIView *spinningActivityIndicator(void) {\r\n\tUIActivityIndicatorView *v = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];\r\n\tv.tintColor = [UIColor colorWith...];\r\n\t[v startAnimating];\r\n\treturn v;\r\n}\r\n\r\n+ (instancetype)newWithCaption:(NSString *)caption {\r\n\t\r\n\treturn [super newWithComponent:[CKStackLayoutComponent\r\n\t\tnewWithView:{}\r\n\t\tsize:{}\r\n\t\tstyle:{\r\n\t\t\t.direction = CKStackLayoutDirectionVertical,\r\n\t\t\t.alignItems = CKStackLayoutAlignItemsCenter\r\n\t\t}\r\n\t\tchildren:{\r\n\t\t\t{\r\n\t\t\t\t[CKComponent\r\n\t\t\t\t\tnewWithView:{&spinningActivityIndicator}\r\n\t\t\t\t\tsize:{\r\n\t\t\t\t\t\t.width = 30,\r\n\t\t\t\t\t\t.height = 30\r\n\t\t\t\t\t}\r\n\t\t\t\t],\r\n\t\t\t\t.spacingBefore = 24\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t[CKLabelComponent ...]\r\n\t\t\t}\r\n\t\t}\r\n\t]];\r\n\t\r\n}\r\n```\r\n\r\nThis component is used as cell in a `UICollectionView` and is present in a collection view at most once together with a lot of other items. However, when scrolling through the list, as the component containing the spinner goes off screen, other components appear and have that same spinner as subview, sometimes even in multiple cells at the same time.\r\n\r\nMy theory is that the cell is reused, but the view is not removed before that appropriately.\r\n\r\nHowever, I have not yet found a 100% reliable way to reproduce this issue.\r\n\r\nLet me know if there is anything I can do to clarify the issue, or if I am doing something wrong and this is actually working as intended."},"comment":{"url":"https://api.github.com/repos/facebook/componentkit/issues/comments/141960135","html_url":"https://github.com/facebook/componentkit/issues/327#issuecomment-141960135","issue_url":"https://api.github.com/repos/facebook/componentkit/issues/327","id":141960135,"user":{"login":"leoschweizer","id":428354,"avatar_url":"https://avatars.githubusercontent.com/u/428354?v=3","gravatar_id":"","url":"https://api.github.com/users/leoschweizer","html_url":"https://github.com/leoschweizer","followers_url":"https://api.github.com/users/leoschweizer/followers","following_url":"https://api.github.com/users/leoschweizer/following{/other_user}","gists_url":"https://api.github.com/users/leoschweizer/gists{/gist_id}","starred_url":"https://api.github.com/users/leoschweizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leoschweizer/subscriptions","organizations_url":"https://api.github.com/users/leoschweizer/orgs","repos_url":"https://api.github.com/users/leoschweizer/repos","events_url":"https://api.github.com/users/leoschweizer/events{/privacy}","received_events_url":"https://api.github.com/users/leoschweizer/received_events","type":"User","site_admin":false},"created_at":"2015-09-21T12:37:43Z","updated_at":"2015-09-21T12:37:43Z","body":"Unfortunately, I can't share the project where this bug actually occurs. Maybe I can find the time to build a reproducible example anytime soon...\r\n\r\nHere's what I can tell right now:\r\n* I have a UICollectionView with a drill-down navigation structure (so when you click an item in the collection, a detail view controller is pushed to the navigation controller)\r\n* This collection view has two sections; in the first section, the actual list items are displayed, and the second section shows the spinner. Every time the spinner component loads, I trigger a data fetch (endless scrolling pattern).\r\n* The bug actually occurred when drilling down and navigating back to the collection view; more often than not, the spinner would show up in one or more of the visible collection view cells even in cases were it shouldn't even be displayed anywhere in the collection view.\r\n* Also very weird is that sometimes, multiple instances of the spinner view would show up, although at no point there should be more than one spinner displayed in the whole collection view"}}