{"action":"published","release":{"url":"https://api.github.com/repos/vigetlabs/microcosm/releases/4409160","assets_url":"https://api.github.com/repos/vigetlabs/microcosm/releases/4409160/assets","upload_url":"https://uploads.github.com/repos/vigetlabs/microcosm/releases/4409160/assets{?name,label}","html_url":"https://github.com/vigetlabs/microcosm/releases/tag/v10.0.0","id":4409160,"tag_name":"v10.0.0","target_commitish":"master","name":"Version 10.0.0","draft":false,"author":{"login":"nhunzaker","id":590904,"avatar_url":"https://avatars.githubusercontent.com/u/590904?v=3","gravatar_id":"","url":"https://api.github.com/users/nhunzaker","html_url":"https://github.com/nhunzaker","followers_url":"https://api.github.com/users/nhunzaker/followers","following_url":"https://api.github.com/users/nhunzaker/following{/other_user}","gists_url":"https://api.github.com/users/nhunzaker/gists{/gist_id}","starred_url":"https://api.github.com/users/nhunzaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhunzaker/subscriptions","organizations_url":"https://api.github.com/users/nhunzaker/orgs","repos_url":"https://api.github.com/users/nhunzaker/repos","events_url":"https://api.github.com/users/nhunzaker/events{/privacy}","received_events_url":"https://api.github.com/users/nhunzaker/received_events","type":"User","site_admin":false},"prerelease":false,"created_at":"2016-10-17T15:59:48Z","published_at":"2016-10-17T16:00:27Z","assets":[],"tarball_url":"https://api.github.com/repos/vigetlabs/microcosm/tarball/v10.0.0","zipball_url":"https://api.github.com/repos/vigetlabs/microcosm/zipball/v10.0.0","body":"We made it! It's been a long road, but we're finally here.\r\n\r\nThis is a significant release. We've added some new tools for medium\r\nto large applications, and made some naming convention changes to make\r\nthings more accurate to their purpose. Actions and Stores (now\r\nDomains) also received significant upgrades.\r\n\r\nHigh level list:\r\n\r\n- All instances of `store` have been renamed to `domain`.\r\n- All instances of `app` have been renamed to `repo`\r\n- `Microcosm::replace` is now `Microcosm::patch`. `patch` does not\r\n  deserialize data. `replace` is deprecated and will eventually be\r\n  removed.\r\n- Removed Plugins\r\n- Removed the generator form for actions. Actions now support a thunk\r\n  form (see [the docs](./docs/api/actions.md)).\r\n- `repo.push` now returns the action representing the provided action\r\n  creator.\r\n- Added `pure` option, true by default. When true, change events\r\n  will only fire when state is shallowly not equal.\r\n- Microcosms can now be \"forked\". \"Child\" Microcosms receive the state\r\n  of their parents and share the same action history, however can\r\n  safely add new domains and make modifications to repo state without\r\n  affecting the parent.\r\n- Added `Presenter` add-on that replaces `Provider` and\r\n  `Connect`. Presenters extend from React.Component and can be used to\r\n  extract state out of a Microcosm and send it into a \"passive view\"\r\n  component.\r\n- Added `withIntent` and `form` add-on. These add-ons provide an API\r\n  for sending messages to Presenters without needing to pass callbacks\r\n  deeply into the component tree.\r\n\r\n### No more plugins\r\n\r\nMicrocosm 9.x has a `start` method that must be called to begin using\r\nit. This method sets initial state and runs through all plugins,\r\nexecuting them in order.\r\n\r\nWe really liked plugins, however this extra step was cumbersome and\r\nmakes it harder to support embedding microcosms within\r\ncomponents. This is important for future planning, so we took\r\nadvantage of the major release to remove plugins.\r\n\r\nWe've added a `setup` method to the `Microcosm` prototype. We've found\r\nmost plugins can easily be converted into direct function calls, like:\r\n\r\n```javascript\r\nclass Repo extends Microcosm) {\r\n  setup () {\r\n    plugin(this, options)\r\n  }\r\n}\r\n```\r\n\r\n### Domains (no longer called Stores)\r\n\r\n- **Domains can no longer be functions that return a\r\n  registration**. This wasn't being used, and makes it easier to check\r\n  if a Store should be instantiated when added (see next item).\r\n- Domains can now be classes. When added, they will be instantiated\r\n  (though no parameters are currently passed to the constructor; still\r\n  figuring this one out).\r\n- Added a `setup` method to Domains. This is a one time lifecycle\r\n  method that runs when a store is added to a Microcosm.\r\n- Domains can now implement a `commit` method that indicates how a\r\n  store should write to `repo.state`. When used with `staging`, this\r\n  is useful for keeping complex data types internal to a Microcosm,\r\n  exposing vanilla JS data via `repo.state`.\r\n- Domains can now implement a `shouldCommit` method that determines if\r\n  `commit` should run (see `docs/recipes/immutable-js.md`)\r\n\r\n#### State management\r\n\r\nRepo state now has two extra phases: `stage` and `commit`. Domains\r\nhandlers work against a internal staging ground. Domains can then\r\ncommit state as a separate operation.\r\n\r\nFor example, when working with ImmutableJS:\r\n\r\n```javascript\r\nconst ImmutableDomain = {\r\n  getInitialState() {\r\n    return Immutable.Map()\r\n  },\r\n\r\n  shouldCommit(next, previous) {\r\n    return Immutable.is(next, previous) === false\r\n  },\r\n\r\n  add(state, record) {\r\n    return state.set(record.id, record)\r\n  },\r\n\r\n  remove(state, id) {\r\n    return state.remove(id)\r\n  }\r\n\r\n  commit(state) {\r\n    return Array.from(state.values())\r\n  }\r\n}\r\n```\r\n\r\n`shouldCommit` returns `true` by default, and `commit` just passes\r\nalong state. When warranted, these new hooks should grant a high\r\ndegree of separation between a Domain's internal data management and\r\nthe data consumed by a component tree.\r\n\r\n### Actions\r\n\r\nActions have been significantly upgraded to allow for complicated\r\nasync operations.\r\n\r\n- Actions can now be simple strings. In these cases, the first\r\n  argument of the pushed action is forwarded to stores.\r\n- Properly display missing action reporting when dispatching an\r\n  undefined action.\r\n\r\nWe removed the generator form for actions. Instead, actions can return\r\na function to get greater control over async operations:\r\n\r\n```javascript\r\nfunction getUser (id) {\r\n  return function (action) {\r\n    const request = ajax('/users/' + id)\r\n\r\n    action.open(id)\r\n\r\n    request.on('load', (data) => action.resolve(data))\r\n\r\n    request.on('error', (error) => action.reject(error))\r\n  }\r\n}\r\n```\r\n\r\nDomains can subscribe to these fine-grained action states:\r\n\r\n```javascript\r\nconst UserDomain = {\r\n  // ... handlers\r\n  register() {\r\n    return {\r\n      [getUser.open]  : this.setLoading,\r\n      [getUser.done]  : this.updateUser,\r\n      [getUser.error] : this.setFailure\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Presenter Addon\r\n\r\nWe've removed the `Connect` and `Provide` addons in favor of a single\r\n`Presenter` addon. Though the API is different (using classes instead\r\nof higher order functions), it accomplishes the same goals.\r\n\r\nFor usage, checkout the [presenter docs](./docs/api/presenter.md)"}}
{"actor":{"display_login":"nhunzaker"}}