{"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/comments/28004060","id":28004060,"diff_hunk":"@@ -25,17 +26,47 @@ angular.module('encore.ui.rxApp', ['encore.ui.rxAppRoutes', 'encore.ui.rxEnviron\n         });\n     };\n \n-    var url = routesCdnPath.staging;\n-    if (Environment.isPreProd()) {\n-        url = routesCdnPath.preprod;\n-    } else if (Environment.isUnifiedProd()) {\n-        url = routesCdnPath.production;\n+    var url, suffix;\n+    switch (true) {\n+        case Environment.isUnifiedProd(): {\n+            url = routesCdnPath.production;\n+            suffix = 'prod';\n+            break;\n+        }\n+        case Environment.isPreProd(): {\n+            url = routesCdnPath.preprod;\n+            suffix = 'preprod';\n+            break;\n+        }\n+        case routesCdnPath.hasCustomURL: {\n+            url = routesCdnPath.staging;\n+            suffix = 'custom';\n+            break;\n+        }\n+        default: {\n+            url = routesCdnPath.staging;\n+            suffix = 'staging';\n+        }\n     }\n \n     encoreRoutes.fetchRoutes = function () {\n-        return $http.get(url)\n-            .success(encoreRoutes.setAll)\n-            .error(setFailureMessage);\n+        var routesKey = 'encoreRoutes-' + suffix;\n+        var cachedRoutes = LocalStorage.getObject(routesKey);\n+\n+        $http.get(url)\n+            .success(function (routes) {\n+                encoreRoutes.setAll(routes);\n+                LocalStorage.setObject(routesKey, routes);\n+            })\n+            .error(function () {\n+                if (cachedRoutes) {\n+                    encoreRoutes.setAll(cachedRoutes);","path":"src/rxApp/rxApp.js","position":63,"original_position":63,"commit_id":"6014a07fb08e5ca682221dbf1a85b9e6fbe42043","original_commit_id":"6014a07fb08e5ca682221dbf1a85b9e6fbe42043","user":{"login":"glynnis","id":1529366,"avatar_url":"https://avatars.githubusercontent.com/u/1529366?v=3","gravatar_id":"","url":"https://api.github.com/users/glynnis","html_url":"https://github.com/glynnis","followers_url":"https://api.github.com/users/glynnis/followers","following_url":"https://api.github.com/users/glynnis/following{/other_user}","gists_url":"https://api.github.com/users/glynnis/gists{/gist_id}","starred_url":"https://api.github.com/users/glynnis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glynnis/subscriptions","organizations_url":"https://api.github.com/users/glynnis/orgs","repos_url":"https://api.github.com/users/glynnis/repos","events_url":"https://api.github.com/users/glynnis/events{/privacy}","received_events_url":"https://api.github.com/users/glynnis/received_events","type":"User","site_admin":false},"body":"That's fine too. Something relatively general like, \"There was a problem loading navigation, so a cached version has been loaded for display.\" ??\r\n\r\nSeems like it should get the orange/warning treatment.","created_at":"2015-04-08T19:26:13Z","updated_at":"2015-04-08T19:26:13Z","html_url":"https://github.com/rackerlabs/encore-ui/pull/886#discussion_r28004060","pull_request_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/886","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/comments/28004060"},"html":{"href":"https://github.com/rackerlabs/encore-ui/pull/886#discussion_r28004060"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/886"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/886","id":32697606,"html_url":"https://github.com/rackerlabs/encore-ui/pull/886","diff_url":"https://github.com/rackerlabs/encore-ui/pull/886.diff","patch_url":"https://github.com/rackerlabs/encore-ui/pull/886.patch","issue_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues/886","number":886,"state":"open","locked":false,"title":"feat(rxApp): cache nav in local storage","user":{"login":"megalord","id":5414922,"avatar_url":"https://avatars.githubusercontent.com/u/5414922?v=3","gravatar_id":"","url":"https://api.github.com/users/megalord","html_url":"https://github.com/megalord","followers_url":"https://api.github.com/users/megalord/followers","following_url":"https://api.github.com/users/megalord/following{/other_user}","gists_url":"https://api.github.com/users/megalord/gists{/gist_id}","starred_url":"https://api.github.com/users/megalord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/megalord/subscriptions","organizations_url":"https://api.github.com/users/megalord/orgs","repos_url":"https://api.github.com/users/megalord/repos","events_url":"https://api.github.com/users/megalord/events{/privacy}","received_events_url":"https://api.github.com/users/megalord/received_events","type":"User","site_admin":false},"body":"Fixes #515 \r\n\r\nWith this change, the nav is initially populated with a cached copy (if available).  If the request to the CDN succeeds, it will overwrite the cached version (both on the page and in the cache).  If the request fails, it will do so silently, and the cached version will be used.","created_at":"2015-04-06T18:16:39Z","updated_at":"2015-04-08T19:26:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfae65f91f0c404980e4d63db1994978e32229be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/886/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/886/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues/886/comments","statuses_url":"https://api.github.com/repos/rackerlabs/encore-ui/statuses/6014a07fb08e5ca682221dbf1a85b9e6fbe42043","head":{"label":"megalord:cache-nav","ref":"cache-nav","sha":"6014a07fb08e5ca682221dbf1a85b9e6fbe42043","user":{"login":"megalord","id":5414922,"avatar_url":"https://avatars.githubusercontent.com/u/5414922?v=3","gravatar_id":"","url":"https://api.github.com/users/megalord","html_url":"https://github.com/megalord","followers_url":"https://api.github.com/users/megalord/followers","following_url":"https://api.github.com/users/megalord/following{/other_user}","gists_url":"https://api.github.com/users/megalord/gists{/gist_id}","starred_url":"https://api.github.com/users/megalord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/megalord/subscriptions","organizations_url":"https://api.github.com/users/megalord/orgs","repos_url":"https://api.github.com/users/megalord/repos","events_url":"https://api.github.com/users/megalord/events{/privacy}","received_events_url":"https://api.github.com/users/megalord/received_events","type":"User","site_admin":false},"repo":{"id":26324960,"name":"encore-ui","full_name":"megalord/encore-ui","owner":{"login":"megalord","id":5414922,"avatar_url":"https://avatars.githubusercontent.com/u/5414922?v=3","gravatar_id":"","url":"https://api.github.com/users/megalord","html_url":"https://github.com/megalord","followers_url":"https://api.github.com/users/megalord/followers","following_url":"https://api.github.com/users/megalord/following{/other_user}","gists_url":"https://api.github.com/users/megalord/gists{/gist_id}","starred_url":"https://api.github.com/users/megalord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/megalord/subscriptions","organizations_url":"https://api.github.com/users/megalord/orgs","repos_url":"https://api.github.com/users/megalord/repos","events_url":"https://api.github.com/users/megalord/events{/privacy}","received_events_url":"https://api.github.com/users/megalord/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/megalord/encore-ui","description":"UI Framework for Encore","fork":true,"url":"https://api.github.com/repos/megalord/encore-ui","forks_url":"https://api.github.com/repos/megalord/encore-ui/forks","keys_url":"https://api.github.com/repos/megalord/encore-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/megalord/encore-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/megalord/encore-ui/teams","hooks_url":"https://api.github.com/repos/megalord/encore-ui/hooks","issue_events_url":"https://api.github.com/repos/megalord/encore-ui/issues/events{/number}","events_url":"https://api.github.com/repos/megalord/encore-ui/events","assignees_url":"https://api.github.com/repos/megalord/encore-ui/assignees{/user}","branches_url":"https://api.github.com/repos/megalord/encore-ui/branches{/branch}","tags_url":"https://api.github.com/repos/megalord/encore-ui/tags","blobs_url":"https://api.github.com/repos/megalord/encore-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/megalord/encore-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/megalord/encore-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/megalord/encore-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/megalord/encore-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/megalord/encore-ui/languages","stargazers_url":"https://api.github.com/repos/megalord/encore-ui/stargazers","contributors_url":"https://api.github.com/repos/megalord/encore-ui/contributors","subscribers_url":"https://api.github.com/repos/megalord/encore-ui/subscribers","subscription_url":"https://api.github.com/repos/megalord/encore-ui/subscription","commits_url":"https://api.github.com/repos/megalord/encore-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/megalord/encore-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/megalord/encore-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/megalord/encore-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/megalord/encore-ui/contents/{+path}","compare_url":"https://api.github.com/repos/megalord/encore-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/megalord/encore-ui/merges","archive_url":"https://api.github.com/repos/megalord/encore-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/megalord/encore-ui/downloads","issues_url":"https://api.github.com/repos/megalord/encore-ui/issues{/number}","pulls_url":"https://api.github.com/repos/megalord/encore-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/megalord/encore-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/megalord/encore-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/megalord/encore-ui/labels{/name}","releases_url":"https://api.github.com/repos/megalord/encore-ui/releases{/id}","created_at":"2014-11-07T15:18:54Z","updated_at":"2015-03-31T18:17:20Z","pushed_at":"2015-04-08T19:07:19Z","git_url":"git://github.com/megalord/encore-ui.git","ssh_url":"git@github.com:megalord/encore-ui.git","clone_url":"https://github.com/megalord/encore-ui.git","svn_url":"https://github.com/megalord/encore-ui","homepage":"http://rackerlabs.github.io/encore-ui/","size":13547,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rackerlabs:master","ref":"master","sha":"ff1917c6d642c052095376d6218e7412894a2cb7","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":11432401,"name":"encore-ui","full_name":"rackerlabs/encore-ui","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/encore-ui","description":"UI Framework for Encore","fork":false,"url":"https://api.github.com/repos/rackerlabs/encore-ui","forks_url":"https://api.github.com/repos/rackerlabs/encore-ui/forks","keys_url":"https://api.github.com/repos/rackerlabs/encore-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/encore-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/encore-ui/teams","hooks_url":"https://api.github.com/repos/rackerlabs/encore-ui/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/encore-ui/events","assignees_url":"https://api.github.com/repos/rackerlabs/encore-ui/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/encore-ui/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/encore-ui/tags","blobs_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/encore-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/encore-ui/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/encore-ui/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/encore-ui/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/encore-ui/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/encore-ui/subscription","commits_url":"https://api.github.com/repos/rackerlabs/encore-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/encore-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/encore-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/encore-ui/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/encore-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/encore-ui/merges","archive_url":"https://api.github.com/repos/rackerlabs/encore-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/encore-ui/downloads","issues_url":"https://api.github.com/repos/rackerlabs/encore-ui/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/encore-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/encore-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/encore-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/encore-ui/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/encore-ui/releases{/id}","created_at":"2013-07-15T20:06:52Z","updated_at":"2015-03-31T14:17:16Z","pushed_at":"2015-04-08T18:58:34Z","git_url":"git://github.com/rackerlabs/encore-ui.git","ssh_url":"git@github.com:rackerlabs/encore-ui.git","clone_url":"https://github.com/rackerlabs/encore-ui.git","svn_url":"https://github.com/rackerlabs/encore-ui","homepage":"http://rackerlabs.github.io/encore-ui/","size":27038,"stargazers_count":24,"watchers_count":24,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":22,"mirror_url":null,"open_issues_count":75,"forks":22,"open_issues":75,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/886"},"html":{"href":"https://github.com/rackerlabs/encore-ui/pull/886"},"issue":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/issues/886"},"comments":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/issues/886/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/886/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/pulls/886/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/encore-ui/statuses/6014a07fb08e5ca682221dbf1a85b9e6fbe42043"}}}}