{"action":"created","issue":{"url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1486","repository_url":"https://api.github.com/repos/sourcegraph/sourcegraph","labels_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1486/labels{/name}","comments_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1486/comments","events_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1486/events","html_url":"https://github.com/sourcegraph/sourcegraph/issues/1486","id":391986427,"node_id":"MDU6SXNzdWUzOTE5ODY0Mjc=","number":1486,"title":"Stop accessing data from window.context in core parts of our logic","user":{"login":"ijsnow","id":11557758,"node_id":"MDQ6VXNlcjExNTU3NzU4","avatar_url":"https://avatars1.githubusercontent.com/u/11557758?v=4","gravatar_id":"","url":"https://api.github.com/users/ijsnow","html_url":"https://github.com/ijsnow","followers_url":"https://api.github.com/users/ijsnow/followers","following_url":"https://api.github.com/users/ijsnow/following{/other_user}","gists_url":"https://api.github.com/users/ijsnow/gists{/gist_id}","starred_url":"https://api.github.com/users/ijsnow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijsnow/subscriptions","organizations_url":"https://api.github.com/users/ijsnow/orgs","repos_url":"https://api.github.com/users/ijsnow/repos","events_url":"https://api.github.com/users/ijsnow/events{/privacy}","received_events_url":"https://api.github.com/users/ijsnow/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/sourcegraph/sourcegraph/milestones/5","html_url":"https://github.com/sourcegraph/sourcegraph/milestone/5","labels_url":"https://api.github.com/repos/sourcegraph/sourcegraph/milestones/5/labels","id":3190996,"node_id":"MDk6TWlsZXN0b25lMzE5MDk5Ng==","number":5,"title":"Backlog","description":null,"creator":{"login":"nicksnyder","id":754768,"node_id":"MDQ6VXNlcjc1NDc2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/754768?v=4","gravatar_id":"","url":"https://api.github.com/users/nicksnyder","html_url":"https://github.com/nicksnyder","followers_url":"https://api.github.com/users/nicksnyder/followers","following_url":"https://api.github.com/users/nicksnyder/following{/other_user}","gists_url":"https://api.github.com/users/nicksnyder/gists{/gist_id}","starred_url":"https://api.github.com/users/nicksnyder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicksnyder/subscriptions","organizations_url":"https://api.github.com/users/nicksnyder/orgs","repos_url":"https://api.github.com/users/nicksnyder/repos","events_url":"https://api.github.com/users/nicksnyder/events{/privacy}","received_events_url":"https://api.github.com/users/nicksnyder/received_events","type":"User","site_admin":false},"open_issues":208,"closed_issues":26,"state":"open","created_at":"2018-03-15T16:12:22Z","updated_at":"2018-12-18T03:54:20Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2018-12-18T03:54:13Z","updated_at":"2018-12-18T18:02:18Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"We store data on `window.context`. This makes writing unit tests hard because they will fail when trying to access data from there. It is also generally bad practice to extend globals in JS.\r\n\r\nWe should either:\r\n\r\n1. Stop storing data there and fetch all data as we do in `siteFlags`\r\n2. Change code architecture to only access global variables like this and pass it through the react application with react context (not props everywhere like `isLightTheme`). We can then use this info to create things like `eventLogger` on the fly rather than importing it as a global variable.\r\n3. Both?"},"comment":{"url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/comments/448313331","html_url":"https://github.com/sourcegraph/sourcegraph/issues/1486#issuecomment-448313331","issue_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1486","id":448313331,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODMxMzMzMQ==","user":{"login":"ijsnow","id":11557758,"node_id":"MDQ6VXNlcjExNTU3NzU4","avatar_url":"https://avatars1.githubusercontent.com/u/11557758?v=4","gravatar_id":"","url":"https://api.github.com/users/ijsnow","html_url":"https://github.com/ijsnow","followers_url":"https://api.github.com/users/ijsnow/followers","following_url":"https://api.github.com/users/ijsnow/following{/other_user}","gists_url":"https://api.github.com/users/ijsnow/gists{/gist_id}","starred_url":"https://api.github.com/users/ijsnow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijsnow/subscriptions","organizations_url":"https://api.github.com/users/ijsnow/orgs","repos_url":"https://api.github.com/users/ijsnow/repos","events_url":"https://api.github.com/users/ijsnow/events{/privacy}","received_events_url":"https://api.github.com/users/ijsnow/received_events","type":"User","site_admin":false},"created_at":"2018-12-18T18:02:18Z","updated_at":"2018-12-18T18:02:18Z","author_association":"CONTRIBUTOR","body":"I'm curious why we at Sourcegraph are against using context? Passing down this kind of data to deeply nested components across the entire react component tree was seen as a big enough problem for this to get built into react so why are we opposed to going with the community on this?\r\n\r\nI think we'd see a lot cleaner code if we used context for this as well as things like `isLightTheme`. Color theme is a perfect example. Pretty much every example you'll see for react context is for color themes."}}
{"actor":{"display_login":"ijsnow"}}