{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/kibana/issues/8022","repository_url":"https://api.github.com/repos/elastic/kibana","labels_url":"https://api.github.com/repos/elastic/kibana/issues/8022/labels{/name}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/8022/comments","events_url":"https://api.github.com/repos/elastic/kibana/issues/8022/events","html_url":"https://github.com/elastic/kibana/pull/8022","id":171836379,"number":8022,"title":"[state] store actual state value in session storage","user":{"login":"spalger","id":1329312,"avatar_url":"https://avatars.githubusercontent.com/u/1329312?v=3","gravatar_id":"","url":"https://api.github.com/users/spalger","html_url":"https://github.com/spalger","followers_url":"https://api.github.com/users/spalger/followers","following_url":"https://api.github.com/users/spalger/following{/other_user}","gists_url":"https://api.github.com/users/spalger/gists{/gist_id}","starred_url":"https://api.github.com/users/spalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalger/subscriptions","organizations_url":"https://api.github.com/users/spalger/orgs","repos_url":"https://api.github.com/users/spalger/repos","events_url":"https://api.github.com/users/spalger/events{/privacy}","received_events_url":"https://api.github.com/users/spalger/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/kibana/labels/review","name":"review","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"tylersmalley","id":40265,"avatar_url":"https://avatars.githubusercontent.com/u/40265?v=3","gravatar_id":"","url":"https://api.github.com/users/tylersmalley","html_url":"https://github.com/tylersmalley","followers_url":"https://api.github.com/users/tylersmalley/followers","following_url":"https://api.github.com/users/tylersmalley/following{/other_user}","gists_url":"https://api.github.com/users/tylersmalley/gists{/gist_id}","starred_url":"https://api.github.com/users/tylersmalley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylersmalley/subscriptions","organizations_url":"https://api.github.com/users/tylersmalley/orgs","repos_url":"https://api.github.com/users/tylersmalley/repos","events_url":"https://api.github.com/users/tylersmalley/events{/privacy}","received_events_url":"https://api.github.com/users/tylersmalley/received_events","type":"User","site_admin":false},"assignees":[{"login":"tylersmalley","id":40265,"avatar_url":"https://avatars.githubusercontent.com/u/40265?v=3","gravatar_id":"","url":"https://api.github.com/users/tylersmalley","html_url":"https://github.com/tylersmalley","followers_url":"https://api.github.com/users/tylersmalley/followers","following_url":"https://api.github.com/users/tylersmalley/following{/other_user}","gists_url":"https://api.github.com/users/tylersmalley/gists{/gist_id}","starred_url":"https://api.github.com/users/tylersmalley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylersmalley/subscriptions","organizations_url":"https://api.github.com/users/tylersmalley/orgs","repos_url":"https://api.github.com/users/tylersmalley/repos","events_url":"https://api.github.com/users/tylersmalley/events{/privacy}","received_events_url":"https://api.github.com/users/tylersmalley/received_events","type":"User","site_admin":false},{"login":"cjcenizal","id":1238659,"avatar_url":"https://avatars.githubusercontent.com/u/1238659?v=3","gravatar_id":"","url":"https://api.github.com/users/cjcenizal","html_url":"https://github.com/cjcenizal","followers_url":"https://api.github.com/users/cjcenizal/followers","following_url":"https://api.github.com/users/cjcenizal/following{/other_user}","gists_url":"https://api.github.com/users/cjcenizal/gists{/gist_id}","starred_url":"https://api.github.com/users/cjcenizal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjcenizal/subscriptions","organizations_url":"https://api.github.com/users/cjcenizal/orgs","repos_url":"https://api.github.com/users/cjcenizal/repos","events_url":"https://api.github.com/users/cjcenizal/events{/privacy}","received_events_url":"https://api.github.com/users/cjcenizal/received_events","type":"User","site_admin":false},{"login":"thomasneirynck","id":1833023,"avatar_url":"https://avatars.githubusercontent.com/u/1833023?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasneirynck","html_url":"https://github.com/thomasneirynck","followers_url":"https://api.github.com/users/thomasneirynck/followers","following_url":"https://api.github.com/users/thomasneirynck/following{/other_user}","gists_url":"https://api.github.com/users/thomasneirynck/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasneirynck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasneirynck/subscriptions","organizations_url":"https://api.github.com/users/thomasneirynck/orgs","repos_url":"https://api.github.com/users/thomasneirynck/repos","events_url":"https://api.github.com/users/thomasneirynck/events{/privacy}","received_events_url":"https://api.github.com/users/thomasneirynck/received_events","type":"User","site_admin":false}],"milestone":null,"comments":12,"created_at":"2016-08-18T07:36:46Z","updated_at":"2016-09-07T00:08:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/8022","html_url":"https://github.com/elastic/kibana/pull/8022","diff_url":"https://github.com/elastic/kibana/pull/8022.diff","patch_url":"https://github.com/elastic/kibana/pull/8022.patch"},"body":"Fixes: https://github.com/elastic/kibana/issues/3947\r\n\r\n## Approach \r\nThis solution focuses on the way that the `appState` and `globalState` communicate with the URL. By intercepting all reads/writes to the `$location` service in the `State` classes (superclass for both app and global state) we can store a hash of the content in the URL, and the actual content in `sessionStorage`.\r\n\r\nThe primary mechanisms providing this functionality are the [`HashedItemStore`](https://github.com/spalger/kibana/blob/implement/storeStateInLocalstorage/src/ui/public/state_management/state_storage/hashed_item_store.js), the [`createStateHash()`](https://github.com/spalger/kibana/blob/implement/storeStateInLocalstorage/src/ui/public/state_management/state_storage/state_hash.js) function, and the [`isStateHash()`](https://github.com/spalger/kibana/blob/implement/storeStateInLocalstorage/src/ui/public/state_management/state_storage/state_hash.js) function.\r\n\r\nThe `createStateHash()` function accepts a string and produces the short hashes shown in the url.\r\n\r\nThe `isStateHash()` function is a identifies the hashes produced by the `createStateHash()` function by their `h@` prefix. This is how we accomplish backwards-compatibility.\r\n\r\nThe `HashedItemStore` is essentially a least-recently-used cache built on top of session storage. It's primary responsibility is tracking which hashes are used and when so that when no more history entries will fit in `sessionStorage` the oldest entries can be removed until enough space is available.\r\n\r\n![2016-08-18 00_42_39](https://cloud.githubusercontent.com/assets/1329312/17765769/b44392f6-64dc-11e6-98cf-52d37db4bd6d.gif)\r\n\r\n## Backwards Compatability\r\n\r\nSince the hashes produced by `createStateHash()` can be identified by the `isStateHash()` function, the `State` class is able to support state query string param values that are either hashed or rison formatted. When a rison formatted query string value is found it is decoded and immediately converted to a hash. \r\n\r\n## Opening stateful urls\r\n\r\nSince the hash in the URL can not be converted back to it's raw state value without access to session storage (and session storage is *tab* specific), copying the url in the browser chrome and pasting it into a new tab will cause a (hopefully helpful) error to be shown. This error directs users to the share ui where they can get an un-hashed version of the URL or create a short url from that full un-hashed url. -- related #8051\r\n\r\nIn order to prevent requiring this step at all times, all links throughout the UI use the same un-hashed version of the url that the share ui exposes. Because these links do not have hashes they can be opened in a new tab without issue (via right-click or ctrl/cmd-click)"},"comment":{"url":"https://api.github.com/repos/elastic/kibana/issues/comments/245134930","html_url":"https://github.com/elastic/kibana/pull/8022#issuecomment-245134930","issue_url":"https://api.github.com/repos/elastic/kibana/issues/8022","id":245134930,"user":{"login":"spalger","id":1329312,"avatar_url":"https://avatars.githubusercontent.com/u/1329312?v=3","gravatar_id":"","url":"https://api.github.com/users/spalger","html_url":"https://github.com/spalger","followers_url":"https://api.github.com/users/spalger/followers","following_url":"https://api.github.com/users/spalger/following{/other_user}","gists_url":"https://api.github.com/users/spalger/gists{/gist_id}","starred_url":"https://api.github.com/users/spalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalger/subscriptions","organizations_url":"https://api.github.com/users/spalger/orgs","repos_url":"https://api.github.com/users/spalger/repos","events_url":"https://api.github.com/users/spalger/events{/privacy}","received_events_url":"https://api.github.com/users/spalger/received_events","type":"User","site_admin":false},"created_at":"2016-09-07T00:08:54Z","updated_at":"2016-09-07T00:08:54Z","body":"Alright, this had been disabled by default and the warning in that shows up before overflow, as well as the overflow page, have been updated to link users to the setting."}}
{"actor":{"display_login":"spalger"}}