{"action":"created","comment":{"url":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/comments/39105685","id":39105685,"diff_hunk":"@@ -379,40 +379,42 @@ - (void)fetchItemsWithCompletion:(void (^)(NSArray *items))completion\n             self.title = self.folder.name;\n         }\n     }];\n-\n-    // Fetch items\n-    [self fetchItemsInFolderID:self.folderID withCompletion:^(NSArray *items, NSError *error) {\n-        if (error == nil) {\n-            completion(items);\n-        } else {\n-            self.navigationController.toolbarHidden = YES;\n-            [self didFailToLoadItemsWithError:error];\n-        }\n-        \n-        if (self.tableView.visibleCells.count < 1) {\n-            [self switchToEmptyStateWithError:error];\n-            self.searchController.searchBar.hidden = YES;\n-        } else {\n-            [self switchToNonEmptyView];\n-            self.searchController.searchBar.hidden = NO;\n-        }\n-    }];\n-}\n-\n-- (void)fetchItemsInFolderID:(NSString *)folderID withCompletion:(void (^)(NSArray *items, NSError *error))completion\n-{\n-    BOXFolderItemsRequest *request = [self.contentClient folderItemsRequestWithID:folderID];\n+    \n+    BOXFolderItemsRequest *request = [self.contentClient folderItemsRequestWithID:self.folderID];\n     request.SDKIdentifier = BOX_BROWSE_SDK_IDENTIFIER;\n     request.SDKVersion = BOX_BROWSE_SDK_VERSION;\n     [request setRequestAllItemFields:YES];\n     \n+    __block NSArray *itemsFromCache = nil;\n+    __weak BOXFolderViewController *me = self;\n+    \n     [request performRequestWithCached:^(NSArray *items, NSError *error) {\n-        if (completion) {\n-            completion(items, error);\n+        itemsFromCache = items;\n+        if (completion && error == nil) {\n+            completion(items);\n+        }\n+        \n+        if (me.tableView.visibleCells.count < 1) {\n+            [me switchToEmptyStateWithError:error];\n+            me.searchController.searchBar.hidden = YES;\n+        } else {\n+            [me switchToNonEmptyView];\n+            me.searchController.searchBar.hidden = NO;\n         }\n     } refreshed:^(NSArray *items, NSError *error) {\n-        if (completion) {\n-            completion(items, error);\n+        if (completion && error == nil) {\n+            completion(items);\n+        } else if (itemsFromCache == nil) {","path":"BoxBrowseSDK/BoxBrowseSDK/BOXFolderViewController.m","position":56,"original_position":56,"commit_id":"17eaa28fe49cfdcdd7717dd1d53c302aa92d1a45","original_commit_id":"17eaa28fe49cfdcdd7717dd1d53c302aa92d1a45","user":{"login":"RicoYao","id":940711,"avatar_url":"https://avatars.githubusercontent.com/u/940711?v=3","gravatar_id":"","url":"https://api.github.com/users/RicoYao","html_url":"https://github.com/RicoYao","followers_url":"https://api.github.com/users/RicoYao/followers","following_url":"https://api.github.com/users/RicoYao/following{/other_user}","gists_url":"https://api.github.com/users/RicoYao/gists{/gist_id}","starred_url":"https://api.github.com/users/RicoYao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RicoYao/subscriptions","organizations_url":"https://api.github.com/users/RicoYao/orgs","repos_url":"https://api.github.com/users/RicoYao/repos","events_url":"https://api.github.com/users/RicoYao/events{/privacy}","received_events_url":"https://api.github.com/users/RicoYao/received_events","type":"User","site_admin":false},"body":"completion is passed down from the parent class when this is invoked so it should always be set, but i'll add a check anyway","created_at":"2015-09-09T22:34:59Z","updated_at":"2015-09-09T22:34:59Z","html_url":"https://github.com/box/box-ios-browse-sdk/pull/39#discussion_r39105685","pull_request_url":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/comments/39105685"},"html":{"href":"https://github.com/box/box-ios-browse-sdk/pull/39#discussion_r39105685"},"pull_request":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/39","id":44607147,"html_url":"https://github.com/box/box-ios-browse-sdk/pull/39","diff_url":"https://github.com/box/box-ios-browse-sdk/pull/39.diff","patch_url":"https://github.com/box/box-ios-browse-sdk/pull/39.patch","issue_url":"https://api.github.com/repos/box/box-ios-browse-sdk/issues/39","number":39,"state":"open","locked":false,"title":"If we are able to load folder contents from cache but not from the network, don't switch into error state.","user":{"login":"RicoYao","id":940711,"avatar_url":"https://avatars.githubusercontent.com/u/940711?v=3","gravatar_id":"","url":"https://api.github.com/users/RicoYao","html_url":"https://github.com/RicoYao","followers_url":"https://api.github.com/users/RicoYao/followers","following_url":"https://api.github.com/users/RicoYao/following{/other_user}","gists_url":"https://api.github.com/users/RicoYao/gists{/gist_id}","starred_url":"https://api.github.com/users/RicoYao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RicoYao/subscriptions","organizations_url":"https://api.github.com/users/RicoYao/orgs","repos_url":"https://api.github.com/users/RicoYao/repos","events_url":"https://api.github.com/users/RicoYao/events{/privacy}","received_events_url":"https://api.github.com/users/RicoYao/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-09T22:13:10Z","updated_at":"2015-09-09T22:34:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b61a1448fd2e0dce273bde69efb3cfee32e3efc","assignee":{"login":"boxtcarpel","id":1891864,"avatar_url":"https://avatars.githubusercontent.com/u/1891864?v=3","gravatar_id":"","url":"https://api.github.com/users/boxtcarpel","html_url":"https://github.com/boxtcarpel","followers_url":"https://api.github.com/users/boxtcarpel/followers","following_url":"https://api.github.com/users/boxtcarpel/following{/other_user}","gists_url":"https://api.github.com/users/boxtcarpel/gists{/gist_id}","starred_url":"https://api.github.com/users/boxtcarpel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boxtcarpel/subscriptions","organizations_url":"https://api.github.com/users/boxtcarpel/orgs","repos_url":"https://api.github.com/users/boxtcarpel/repos","events_url":"https://api.github.com/users/boxtcarpel/events{/privacy}","received_events_url":"https://api.github.com/users/boxtcarpel/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/39/commits","review_comments_url":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/39/comments","review_comment_url":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/box/box-ios-browse-sdk/issues/39/comments","statuses_url":"https://api.github.com/repos/box/box-ios-browse-sdk/statuses/17eaa28fe49cfdcdd7717dd1d53c302aa92d1a45","head":{"label":"box:cache_refresh_timing","ref":"cache_refresh_timing","sha":"17eaa28fe49cfdcdd7717dd1d53c302aa92d1a45","user":{"login":"box","id":23900,"avatar_url":"https://avatars.githubusercontent.com/u/23900?v=3","gravatar_id":"","url":"https://api.github.com/users/box","html_url":"https://github.com/box","followers_url":"https://api.github.com/users/box/followers","following_url":"https://api.github.com/users/box/following{/other_user}","gists_url":"https://api.github.com/users/box/gists{/gist_id}","starred_url":"https://api.github.com/users/box/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/box/subscriptions","organizations_url":"https://api.github.com/users/box/orgs","repos_url":"https://api.github.com/users/box/repos","events_url":"https://api.github.com/users/box/events{/privacy}","received_events_url":"https://api.github.com/users/box/received_events","type":"Organization","site_admin":false},"repo":{"id":33955420,"name":"box-ios-browse-sdk","full_name":"box/box-ios-browse-sdk","owner":{"login":"box","id":23900,"avatar_url":"https://avatars.githubusercontent.com/u/23900?v=3","gravatar_id":"","url":"https://api.github.com/users/box","html_url":"https://github.com/box","followers_url":"https://api.github.com/users/box/followers","following_url":"https://api.github.com/users/box/following{/other_user}","gists_url":"https://api.github.com/users/box/gists{/gist_id}","starred_url":"https://api.github.com/users/box/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/box/subscriptions","organizations_url":"https://api.github.com/users/box/orgs","repos_url":"https://api.github.com/users/box/repos","events_url":"https://api.github.com/users/box/events{/privacy}","received_events_url":"https://api.github.com/users/box/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/box/box-ios-browse-sdk","description":"","fork":false,"url":"https://api.github.com/repos/box/box-ios-browse-sdk","forks_url":"https://api.github.com/repos/box/box-ios-browse-sdk/forks","keys_url":"https://api.github.com/repos/box/box-ios-browse-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/box/box-ios-browse-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/box/box-ios-browse-sdk/teams","hooks_url":"https://api.github.com/repos/box/box-ios-browse-sdk/hooks","issue_events_url":"https://api.github.com/repos/box/box-ios-browse-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/box/box-ios-browse-sdk/events","assignees_url":"https://api.github.com/repos/box/box-ios-browse-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/box/box-ios-browse-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/box/box-ios-browse-sdk/tags","blobs_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/box/box-ios-browse-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/box/box-ios-browse-sdk/languages","stargazers_url":"https://api.github.com/repos/box/box-ios-browse-sdk/stargazers","contributors_url":"https://api.github.com/repos/box/box-ios-browse-sdk/contributors","subscribers_url":"https://api.github.com/repos/box/box-ios-browse-sdk/subscribers","subscription_url":"https://api.github.com/repos/box/box-ios-browse-sdk/subscription","commits_url":"https://api.github.com/repos/box/box-ios-browse-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/box/box-ios-browse-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/box/box-ios-browse-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/box/box-ios-browse-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/box/box-ios-browse-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/box/box-ios-browse-sdk/merges","archive_url":"https://api.github.com/repos/box/box-ios-browse-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/box/box-ios-browse-sdk/downloads","issues_url":"https://api.github.com/repos/box/box-ios-browse-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/box/box-ios-browse-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/box/box-ios-browse-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/box/box-ios-browse-sdk/labels{/name}","releases_url":"https://api.github.com/repos/box/box-ios-browse-sdk/releases{/id}","created_at":"2015-04-14T20:30:27Z","updated_at":"2015-08-13T21:38:33Z","pushed_at":"2015-09-09T22:13:10Z","git_url":"git://github.com/box/box-ios-browse-sdk.git","ssh_url":"git@github.com:box/box-ios-browse-sdk.git","clone_url":"https://github.com/box/box-ios-browse-sdk.git","svn_url":"https://github.com/box/box-ios-browse-sdk","homepage":null,"size":938,"stargazers_count":8,"watchers_count":8,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":8,"default_branch":"master"}},"base":{"label":"box:capture","ref":"capture","sha":"d8f1b4024335afe5a056e25671a3a49446aedd51","user":{"login":"box","id":23900,"avatar_url":"https://avatars.githubusercontent.com/u/23900?v=3","gravatar_id":"","url":"https://api.github.com/users/box","html_url":"https://github.com/box","followers_url":"https://api.github.com/users/box/followers","following_url":"https://api.github.com/users/box/following{/other_user}","gists_url":"https://api.github.com/users/box/gists{/gist_id}","starred_url":"https://api.github.com/users/box/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/box/subscriptions","organizations_url":"https://api.github.com/users/box/orgs","repos_url":"https://api.github.com/users/box/repos","events_url":"https://api.github.com/users/box/events{/privacy}","received_events_url":"https://api.github.com/users/box/received_events","type":"Organization","site_admin":false},"repo":{"id":33955420,"name":"box-ios-browse-sdk","full_name":"box/box-ios-browse-sdk","owner":{"login":"box","id":23900,"avatar_url":"https://avatars.githubusercontent.com/u/23900?v=3","gravatar_id":"","url":"https://api.github.com/users/box","html_url":"https://github.com/box","followers_url":"https://api.github.com/users/box/followers","following_url":"https://api.github.com/users/box/following{/other_user}","gists_url":"https://api.github.com/users/box/gists{/gist_id}","starred_url":"https://api.github.com/users/box/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/box/subscriptions","organizations_url":"https://api.github.com/users/box/orgs","repos_url":"https://api.github.com/users/box/repos","events_url":"https://api.github.com/users/box/events{/privacy}","received_events_url":"https://api.github.com/users/box/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/box/box-ios-browse-sdk","description":"","fork":false,"url":"https://api.github.com/repos/box/box-ios-browse-sdk","forks_url":"https://api.github.com/repos/box/box-ios-browse-sdk/forks","keys_url":"https://api.github.com/repos/box/box-ios-browse-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/box/box-ios-browse-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/box/box-ios-browse-sdk/teams","hooks_url":"https://api.github.com/repos/box/box-ios-browse-sdk/hooks","issue_events_url":"https://api.github.com/repos/box/box-ios-browse-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/box/box-ios-browse-sdk/events","assignees_url":"https://api.github.com/repos/box/box-ios-browse-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/box/box-ios-browse-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/box/box-ios-browse-sdk/tags","blobs_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/box/box-ios-browse-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/box/box-ios-browse-sdk/languages","stargazers_url":"https://api.github.com/repos/box/box-ios-browse-sdk/stargazers","contributors_url":"https://api.github.com/repos/box/box-ios-browse-sdk/contributors","subscribers_url":"https://api.github.com/repos/box/box-ios-browse-sdk/subscribers","subscription_url":"https://api.github.com/repos/box/box-ios-browse-sdk/subscription","commits_url":"https://api.github.com/repos/box/box-ios-browse-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/box/box-ios-browse-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/box/box-ios-browse-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/box/box-ios-browse-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/box/box-ios-browse-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/box/box-ios-browse-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/box/box-ios-browse-sdk/merges","archive_url":"https://api.github.com/repos/box/box-ios-browse-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/box/box-ios-browse-sdk/downloads","issues_url":"https://api.github.com/repos/box/box-ios-browse-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/box/box-ios-browse-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/box/box-ios-browse-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/box/box-ios-browse-sdk/labels{/name}","releases_url":"https://api.github.com/repos/box/box-ios-browse-sdk/releases{/id}","created_at":"2015-04-14T20:30:27Z","updated_at":"2015-08-13T21:38:33Z","pushed_at":"2015-09-09T22:13:10Z","git_url":"git://github.com/box/box-ios-browse-sdk.git","ssh_url":"git@github.com:box/box-ios-browse-sdk.git","clone_url":"https://github.com/box/box-ios-browse-sdk.git","svn_url":"https://github.com/box/box-ios-browse-sdk","homepage":null,"size":938,"stargazers_count":8,"watchers_count":8,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/39"},"html":{"href":"https://github.com/box/box-ios-browse-sdk/pull/39"},"issue":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/issues/39"},"comments":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/box/box-ios-browse-sdk/statuses/17eaa28fe49cfdcdd7717dd1d53c302aa92d1a45"}}}}