{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1619","repository_url":"https://api.github.com/repos/facebook/AsyncDisplayKit","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1619/labels{/name}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1619/comments","events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1619/events","html_url":"https://github.com/facebook/AsyncDisplayKit/pull/1619","id":152905974,"number":1619,"title":"[ASRangeController] Update Synchronously More Often","user":{"login":"Adlai-Holler","id":2466893,"avatar_url":"https://avatars.githubusercontent.com/u/2466893?v=3","gravatar_id":"","url":"https://api.github.com/users/Adlai-Holler","html_url":"https://github.com/Adlai-Holler","followers_url":"https://api.github.com/users/Adlai-Holler/followers","following_url":"https://api.github.com/users/Adlai-Holler/following{/other_user}","gists_url":"https://api.github.com/users/Adlai-Holler/gists{/gist_id}","starred_url":"https://api.github.com/users/Adlai-Holler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Adlai-Holler/subscriptions","organizations_url":"https://api.github.com/users/Adlai-Holler/orgs","repos_url":"https://api.github.com/users/Adlai-Holler/repos","events_url":"https://api.github.com/users/Adlai-Holler/events{/privacy}","received_events_url":"https://api.github.com/users/Adlai-Holler/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/labels/CLA%20Signed","name":"CLA Signed","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-04T00:36:23Z","updated_at":"2016-05-14T06:51:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1619","html_url":"https://github.com/facebook/AsyncDisplayKit/pull/1619","diff_url":"https://github.com/facebook/AsyncDisplayKit/pull/1619.diff","patch_url":"https://github.com/facebook/AsyncDisplayKit/pull/1619.patch"},"body":"First off, I know how critical this code is, so I've tried to minimize changes and especially additions.\r\n\r\n### Big Changes\r\n- Perform update immediately in `visibleNodeIndexPathsDidChangeWithScrollDirection` and `updateRangeWithMode`. This is the meat of the PR. \r\n  - The comment at ASRangeController.mm:98 claimed this was already executed immediately, but it wasn't.\r\n  - Unfortunately this means that we will perform a range update for each call to `willDisplayCell:` rather than max once per run loop. Is this an acceptable cost for the guarantee that a cell will not be visible before the ranges are updated? I believe so.\r\n- Replace `scheduleRangeUpdate` and `performRangeUpdate` with `performRangeUpdateSynchronously:`.\r\n- In ASTableView, change how we compute the visible index paths. Once I started updating synchronously out of `willDisplayCell:` UITableView started returning `nil` from `indexPathForCell:` even though the cells were retrieved through `visibleCells`. The new method is more direct and is still aware of the grouped table view issue that the old one was working around.\r\n\r\n### Small Changes\r\n\r\n- Remove extraneous calls to `performRangeUpdate` in the +ASRangeController application lifecycle methods, because changing the range mode already implies an update. Updated documentation for updateCurrentRangeWithMode: to reflect that fact.\r\n- Stop checking `_queuedRangeUpdate = YES` during the range update. The queuing mechanism lives outside the updating mechanism, and previously we had resorted to simply setting that flag before updating which is silly."},"comment":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/comments/219204681","html_url":"https://github.com/facebook/AsyncDisplayKit/pull/1619#issuecomment-219204681","issue_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1619","id":219204681,"user":{"login":"appleguy","id":565251,"avatar_url":"https://avatars.githubusercontent.com/u/565251?v=3","gravatar_id":"","url":"https://api.github.com/users/appleguy","html_url":"https://github.com/appleguy","followers_url":"https://api.github.com/users/appleguy/followers","following_url":"https://api.github.com/users/appleguy/following{/other_user}","gists_url":"https://api.github.com/users/appleguy/gists{/gist_id}","starred_url":"https://api.github.com/users/appleguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appleguy/subscriptions","organizations_url":"https://api.github.com/users/appleguy/orgs","repos_url":"https://api.github.com/users/appleguy/repos","events_url":"https://api.github.com/users/appleguy/events{/privacy}","received_events_url":"https://api.github.com/users/appleguy/received_events","type":"User","site_admin":false},"created_at":"2016-05-14T06:51:54Z","updated_at":"2016-05-14T06:51:54Z","body":"@maicki I know you have been _very_ busy, for good reasons, in **addition** to being overseas with family! :)  When you have another workday - Monday - let's prioritize getting a round of feedback to Adlai here.  I won't have time due to needing to begin packing for Vietnam, and you are by far the best person on the team to review this (I have a similar level of understanding of this code but don't want to block progress).  Let me know on iMessage if you have any questions or concerns and want to check if I have the same impression about how the existing code works."}}