{"action":"created","issue":{"url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1036","repository_url":"https://api.github.com/repos/mobxjs/mobx-state-tree","labels_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1036/labels{/name}","comments_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1036/comments","events_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1036/events","html_url":"https://github.com/mobxjs/mobx-state-tree/issues/1036","id":368248041,"node_id":"MDU6SXNzdWUzNjgyNDgwNDE=","number":1036,"title":"Update snapshot after action from service side","user":{"login":"stephane-r","id":4712791,"node_id":"MDQ6VXNlcjQ3MTI3OTE=","avatar_url":"https://avatars0.githubusercontent.com/u/4712791?v=4","gravatar_id":"","url":"https://api.github.com/users/stephane-r","html_url":"https://github.com/stephane-r","followers_url":"https://api.github.com/users/stephane-r/followers","following_url":"https://api.github.com/users/stephane-r/following{/other_user}","gists_url":"https://api.github.com/users/stephane-r/gists{/gist_id}","starred_url":"https://api.github.com/users/stephane-r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephane-r/subscriptions","organizations_url":"https://api.github.com/users/stephane-r/orgs","repos_url":"https://api.github.com/users/stephane-r/repos","events_url":"https://api.github.com/users/stephane-r/events{/privacy}","received_events_url":"https://api.github.com/users/stephane-r/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-09T14:45:06Z","updated_at":"2018-10-09T15:47:28Z","closed_at":null,"author_association":"NONE","body":"* [x] A conceptual question. \r\n  * [x] I've checked documentation and searched for existing issues\r\n  * [x] I tried the [spectrum channel](https://spectrum.chat/?t=dad48299-3dfc-4e10-b6da-9af1e39498a3) first\r\n* [ ] I think something is not working as it should.\r\n  * [ ] I've checked documentation and searched for existing issues\r\n  * [ ] I've made sure your project is based on the latest MST version\r\n  * [ ] Fork [this](https://codesandbox.io/s/jlnmjqr7xv) code sandbox or another minimal reproduction. \r\n  * [ ] Describe expected behavior\r\n  * [ ] Describe observed behavior\r\n* [ ] Feature request\r\n   * [ ] Describe the feature and why you feel your feature needs to be generically solved inside MST\r\n   * [ ] Are you willing to (attempt) a PR?\r\n   \r\nHi community,\r\n\r\nI init my store from server side and running actions if needed. For example : \r\n\r\n```\r\n  static async getInitialProps({ Component, ctx }) {\r\n    const token = ctx.req && ctx.req.session && ctx.req.session.token;\r\n    const isServer = true;\r\n    const store = initStore(isServer);\r\n    let pageProps = {};\r\n\r\n    if (Component.getInitialProps) {\r\n      pageProps = await Component.getInitialProps(ctx);\r\n    }\r\n\r\n    if (token) {\r\n      store.app.setConnected();\r\n      console.log(store.app.isConnected);\r\n    }\r\n\r\n    return { pageProps, initialState: getSnapshot(store), isServer, store };\r\n  }\r\n\r\n  componentDidMount() {\r\n    console.log(this.props.initialState);\r\n  }\r\n```\r\n\r\nThe first `console.log(store.app.isConnected` have good value `true`. But on `componentDidMount()` method, the value of `isConnected` is initial : `false` and i don't really understand why.\r\n\r\nMaybe i need to update the snapshot after every action ?\r\n\r\n```\r\n    setConnected() {\r\n      self.isConnected = true;\r\n      // Update snapshot ?\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/comments/428245247","html_url":"https://github.com/mobxjs/mobx-state-tree/issues/1036#issuecomment-428245247","issue_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1036","id":428245247,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODI0NTI0Nw==","user":{"login":"xaviergonz","id":6306796,"node_id":"MDQ6VXNlcjYzMDY3OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/6306796?v=4","gravatar_id":"","url":"https://api.github.com/users/xaviergonz","html_url":"https://github.com/xaviergonz","followers_url":"https://api.github.com/users/xaviergonz/followers","following_url":"https://api.github.com/users/xaviergonz/following{/other_user}","gists_url":"https://api.github.com/users/xaviergonz/gists{/gist_id}","starred_url":"https://api.github.com/users/xaviergonz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xaviergonz/subscriptions","organizations_url":"https://api.github.com/users/xaviergonz/orgs","repos_url":"https://api.github.com/users/xaviergonz/repos","events_url":"https://api.github.com/users/xaviergonz/events{/privacy}","received_events_url":"https://api.github.com/users/xaviergonz/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T15:47:28Z","updated_at":"2018-10-09T15:47:28Z","author_association":"CONTRIBUTOR","body":"Basically getSnapshot is usually used to serialize it to json to store it somewhere. Once you use getSnapshot over a store it becomes a fixed immutable copy of the store at that particular moment it was called."}}
{"actor":{"display_login":"xaviergonz"}}