{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/19028","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/19028/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/19028/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/19028/events","html_url":"https://github.com/facebook/react-native/issues/19028","id":317813891,"number":19028,"title":"Android keeps variables initialized from before dismissing/closing the app ","user":{"login":"MKLOL","id":3678959,"avatar_url":"https://avatars0.githubusercontent.com/u/3678959?v=4","gravatar_id":"","url":"https://api.github.com/users/MKLOL","html_url":"https://github.com/MKLOL","followers_url":"https://api.github.com/users/MKLOL/followers","following_url":"https://api.github.com/users/MKLOL/following{/other_user}","gists_url":"https://api.github.com/users/MKLOL/gists{/gist_id}","starred_url":"https://api.github.com/users/MKLOL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MKLOL/subscriptions","organizations_url":"https://api.github.com/users/MKLOL/orgs","repos_url":"https://api.github.com/users/MKLOL/repos","events_url":"https://api.github.com/users/MKLOL/events{/privacy}","received_events_url":"https://api.github.com/users/MKLOL/received_events","type":"User","site_admin":false},"labels":[{"id":870851515,"url":"https://api.github.com/repos/facebook/react-native/labels/:large_blue_diamond:Android","name":":large_blue_diamond:Android","color":"bfd4f2","default":false},{"id":846765400,"url":"https://api.github.com/repos/facebook/react-native/labels/:rewind:Old%20Version","name":":rewind:Old Version","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-25T22:19:03Z","updated_at":"2018-05-01T20:29:39Z","closed_at":null,"author_association":"NONE","body":"- [X] I have reviewed the [documentation](https://facebook.github.io/react-native)\r\n- [X] I have searched [existing issues](https://github.com/facebook/react-native/issues)\r\n- [ ] I am using the [latest React Native version](https://github.com/facebook/react-native/releases)\r\n\r\nAndroid doesn't seem to reset the javascript context when you dismiss the app and relaunch it. Some variables, that are only initialized once at startup, are already initialized if you close the app and quickly restart it. This doesn't happen on iOS, and it doesn't happen on android if you wait for about a second after you dismiss the app. (I also get more errors/warnings, telling me some listeners are misbehaving, though I create those listeners only after the user logs in, and this happens before the login screen). \r\nThe device I used is a galaxy S7.\r\n\r\n## Environment\r\nEnvironment:\r\n  OS: macOS High Sierra 10.13.4\r\n  Node: 8.9.4\r\n  Yarn: 1.3.2\r\n  npm: 5.6.0\r\n  Watchman: 4.9.0\r\n  Xcode: Xcode 9.3 Build version 9E145\r\n  Android Studio: 2.3 AI-162.4069837\r\n\r\nPackages: (wanted => installed)\r\n  react: 16.2.0 => 16.2.0\r\n  react-native: 0.52.2 => 0.52.2\r\n\r\n## Steps to Reproduce\r\nI have some code that basically looks like this, initialized is ONLY called when the program starts\r\n\r\n```\r\nlet realmThing: Realm | undefined;\r\n\r\nconst RealmThing = {\r\n    initialize: ) => {\r\n        if (realmThing !== undefined) {\r\n            throw Error(\"realm Already initialized); // This happens after dismiss and quick relaunch\r\n        }\r\n        realmThing = new Realm(...);\r\n    },\r\n```\r\nIf you dismiss the app / close the app and then open it fast enough, it will throw that error. (Note: If you wait 1 second after dismissing, it doesn't happen)\r\n## Expected Behavior\r\nThe variable should not be initialized. \r\n\r\n## Actual Behavior\r\nThe variable is initialized. "},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/385780447","html_url":"https://github.com/facebook/react-native/issues/19028#issuecomment-385780447","issue_url":"https://api.github.com/repos/facebook/react-native/issues/19028","id":385780447,"user":{"login":"MKLOL","id":3678959,"avatar_url":"https://avatars0.githubusercontent.com/u/3678959?v=4","gravatar_id":"","url":"https://api.github.com/users/MKLOL","html_url":"https://github.com/MKLOL","followers_url":"https://api.github.com/users/MKLOL/followers","following_url":"https://api.github.com/users/MKLOL/following{/other_user}","gists_url":"https://api.github.com/users/MKLOL/gists{/gist_id}","starred_url":"https://api.github.com/users/MKLOL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MKLOL/subscriptions","organizations_url":"https://api.github.com/users/MKLOL/orgs","repos_url":"https://api.github.com/users/MKLOL/repos","events_url":"https://api.github.com/users/MKLOL/events{/privacy}","received_events_url":"https://api.github.com/users/MKLOL/received_events","type":"User","site_admin":false},"created_at":"2018-05-01T20:29:39Z","updated_at":"2018-05-01T20:29:39Z","author_association":"NONE","body":"Yes, it still happens in the latest version:\r\n\r\nEnvironment:\r\n  OS: macOS High Sierra 10.13.4\r\n  Node: 8.9.4\r\n  Yarn: 1.3.2\r\n  npm: 5.6.0\r\n  Watchman: 4.9.0\r\n  Xcode: Xcode 9.3 Build version 9E145\r\n  Android Studio: 2.3 AI-162.4069837\r\n\r\nPackages: (wanted => installed)\r\n  react: 16.2.0 => 16.2.0\r\n  react-native: ^0.55.3 => 0.55.3\r\n"}}
{"actor":{"display_login":"MKLOL"}}