|
| 1 | +# Change log |
| 2 | + |
| 3 | +All notable changes to this project will be documented in this file. |
| 4 | +This project adheres to [Semantic Versioning](http://semver.org/). |
| 5 | + |
| 6 | +## [Unreleased][unreleased] |
| 7 | + |
| 8 | +## [0.12.0] - 2015/06/19 |
| 9 | +No breaking changes this time. |
| 10 | + |
| 11 | +* Classes returned by decorators now expose a static `DecoratedComponent` property for easier testing |
| 12 | +* Dependencies on `lodash` and `babel-runtime` are dropped |
| 13 | +* Now compatible with Babel loose mode |
| 14 | +* `composeStore` now ignores non-function values (useful in Babel loose mode) |
| 15 | +* A UMD build is added |
| 16 | +* The initial action dispatched to the stores now has a built-in `@@INIT` type (might be useful to devtools) |
| 17 | + |
| 18 | +## [0.11.1] - 2015/06/16 |
| 19 | +* Bugfix: when `Connector` `select` property changes, the state did not recalculate (#107) |
| 20 | + |
| 21 | +## [0.11.0] - 2015/06/14 |
| 22 | +* Renames `compose` root export to `composeMiddleware` to clarify the intent |
| 23 | +* Fixes a bug with `getState` returning stale state after a hot reload (#90) |
| 24 | + |
| 25 | +## [0.10.1] - 2015/06/13 |
| 26 | +Missing from the 0.10 release notes: **React Native is now supported!** |
| 27 | +(And that's actually a breaking change.) |
| 28 | + |
| 29 | +Now, to import React-specific parts (containers or decorators), you need to either import from `redux/react` or `redux/react-native`: |
| 30 | + |
| 31 | +```js |
| 32 | +// Import utilities and functions from redux |
| 33 | +import { createRedux, bindActionCreators } from 'redux'; |
| 34 | + |
| 35 | +// Import components and decorators from redux/react |
| 36 | +import { provide, Connector } from 'redux/react'; |
| 37 | + |
| 38 | +// React Native: Import components and decorators from redux/react-native |
| 39 | +import { provide, Connector } from 'redux/react-native'; |
| 40 | +``` |
| 41 | + |
| 42 | +0.10 release also had a problem with ES6 code inside `redux/react` and `redux/react-native` entry points, which is now fixed. Please upgrade if you had problems with 0.10. |
| 43 | + |
| 44 | +Changes introduced in 0.10.1: |
| 45 | + |
| 46 | +* `Connector` now throws if `select` returns something other than a plain object (https://github.com/gaearon/redux/pull/85) |
| 47 | +* The custom dispatcher API is tweaked so `setState` now returns the state that was actually set. This makes custom dispatchers more composable. (https://github.com/gaearon/redux/pull/77) |
| 48 | + |
| 49 | +Happy reducing! |
| 50 | + |
| 51 | +## [0.10.0] - 2015/06/13 |
| 52 | +### Middleware |
| 53 | + |
| 54 | +Redux 1.0 is within striking distance! Can you believe how quickly Redux has matured? @gaearon made the first commit only [14 days ago](https://github.com/gaearon/redux/commit/8bc14659780c044baac1432845fe1e4ca5123a8d). |
| 55 | + |
| 56 | +The 0.10 release is a follow-up to 0.9, with a focus on what we're calling (at least for now) **middleware**. |
| 57 | + |
| 58 | +You can read all about middleware [here](https://github.com/gaearon/redux/blob/master/docs/middleware.md). We plan to release some official middleware soon, but of course we'd also love to see middleware created by the community. |
| 59 | + |
| 60 | +### Breaking changes |
| 61 | + |
| 62 | +Just a small one: Redux includes a feature that enables you to return a function from an action creator to perform asynchronous dispatches. The function receives a callback and `getState()` as parameters. This has behavior has been re-implemented as middleware and moved into a separate module called [`thunkMiddleware()`](https://github.com/gaearon/redux/blob/master/src/middleware/thunk.js). It is included automatically when using the `createRedux(stores)` shortcut, but not when using `createDispatcher()`. |
| 63 | + |
| 64 | +### Tests |
| 65 | + |
| 66 | +We have tests! Still need to improve coverage in a few areas, but we're currently at ~93%. Not bad! Big thanks to @emmenko for setting these up. |
| 67 | + |
| 68 | +## [0.9.0] - 2015/06/09 |
| 69 | +### Internal Refactoring & Custom Dispatchers |
| 70 | + |
| 71 | +This release brings breaking changes necessary to start experimenting with middleware and extensibility (#6, #55). It does *not* bring any support for middleware *per se*, but it untangles “Dispatcher” (a function that tells how actions turn into state updates) from “Redux” (an instance holding the current state and managing subscriptions). It is now possible to specify your own Dispatcher if you want to experiment with ideas like middleware, time travel, action creators returning Promises or Observables, etc. |
| 72 | + |
| 73 | +* `createDispatcher` now returns a function you need to give to `createRedux` |
| 74 | +* `createRedux` is the primary API you'll use for initialization |
| 75 | +* Instead of `dispatcher` prop, a `dispatch` function prop is injected by the `<Connector>` and `@connect` |
| 76 | +* Instead of `dispatcher` prop, `<Provider>` and `@provide` accept a `redux` prop |
| 77 | +* Instead of `dispatcher.getAtom()`, use `redux.getState()` |
| 78 | +* Instead of `dispatcher.setAtom()`, you may pass a second `initialState` argument to `createRedux` |
| 79 | +* Instead of `dispatcher.perfrorm()` or `dispatcher.dispatch()`, use `redux.dispatch()` |
| 80 | +* `bindActions` is renamed to `bindActionCreators` and accepts `dispatch` as the second parameter |
| 81 | +* You may skip `composeStores` and `createDispatcher` completely and just use `createRedux(stores)` as a shortcut |
| 82 | + |
| 83 | +### How It Looks Like Now |
| 84 | + |
| 85 | +#### Initialization |
| 86 | + |
| 87 | +##### Short Way |
| 88 | + |
| 89 | +This is a shortcut for the most common use case. |
| 90 | + |
| 91 | +```js |
| 92 | +import { createRedux, Provider } from 'redux'; |
| 93 | +import * as stores from '../stores/index'; |
| 94 | + |
| 95 | +const redux = createRedux(stores); |
| 96 | + |
| 97 | +export default class App { |
| 98 | + render() { |
| 99 | + return ( |
| 100 | + <Provider redux={redux}> |
| 101 | + {() => |
| 102 | + <CounterApp /> |
| 103 | + } |
| 104 | + </Provider> |
| 105 | + ); |
| 106 | + } |
| 107 | +} |
| 108 | +``` |
| 109 | + |
| 110 | +###### Long Way |
| 111 | + |
| 112 | +This way of writing lets you use compose Stores differently, or even pass a custom Dispatcher function. Its signature is `(initialState, setState) => (action) => ()`. |
| 113 | + |
| 114 | +```js |
| 115 | +import { createRedux, createDispatcher, composeStores } from 'redux'; |
| 116 | +import * as stores from '../stores/index'; |
| 117 | + |
| 118 | +// Compose all your Stores into a single Store function with `composeStores`: |
| 119 | +const store = composeStores(stores); |
| 120 | + |
| 121 | +// Create a default Dispatcher function for your composite Store: |
| 122 | +const dispatcher = createDispatcher(store); // You may use your custom function here |
| 123 | + |
| 124 | +// Create a Redux instance using the dispatcher function: |
| 125 | +const redux = createRedux(dispatcher); |
| 126 | + |
| 127 | +export default class App { |
| 128 | + render() { |
| 129 | + return ( |
| 130 | + <Provider redux={redux}> |
| 131 | + {() => |
| 132 | + <CounterApp /> |
| 133 | + } |
| 134 | + </Provider> |
| 135 | + ); |
| 136 | + } |
| 137 | +} |
| 138 | +``` |
| 139 | + |
| 140 | +### Hydration and dehydration |
| 141 | + |
| 142 | +```js |
| 143 | +// server |
| 144 | +const redux = createRedux(stores); |
| 145 | +redux.dispatch(MyActionCreators.doSomething()); // fire action creators to fill the state |
| 146 | +const state = redux.getState(); // somehow pass this state to the client |
| 147 | + |
| 148 | +// client |
| 149 | +const initialState = window.STATE_FROM_SERVER; |
| 150 | +const redux = createRedux(stores, initialState); |
| 151 | +``` |
| 152 | + |
| 153 | +### Binding actions |
| 154 | + |
| 155 | +```js |
| 156 | +import React from 'react'; |
| 157 | +import { connect, bindActionCreators } from 'redux'; |
| 158 | +import Counter from '../components/Counter'; |
| 159 | +import * as CounterActions from '../actions/CounterActions'; |
| 160 | + |
| 161 | +@connect(state => ({ |
| 162 | + counter: state.counter |
| 163 | +})) |
| 164 | +export default class CounterApp { |
| 165 | + render() { |
| 166 | + const { counter, dispatch } = this.props; |
| 167 | + return ( |
| 168 | + <Counter counter={counter} |
| 169 | + {...bindActionCreators(CounterActions, dispatch)} /> |
| 170 | + ); |
| 171 | + } |
| 172 | +} |
| 173 | +``` |
| 174 | + |
| 175 | +## [0.8.1] - 2015/06/06 |
| 176 | +* `hydrate()` and `dehydrate()` are gone, welcome `getAtom()` and `setAtom()` instead |
| 177 | +* `initialize()` and `dispose()` are added for advanced use cases |
| 178 | +* changing `select` function now updates the `Connector` state |
| 179 | +* the bug with action creators accepting `dispatch` instead of `perform` is fixed |
| 180 | + |
| 181 | +## [0.8.0] - 2015/06/06 |
| 182 | +### The Big Rewrite! |
| 183 | + |
| 184 | +This release wouldn't have happened without [this @acdlite's wonderful gist](https://gist.github.com/acdlite/9f1b5883d132ad242323). |
| 185 | + |
| 186 | +New: |
| 187 | + |
| 188 | +* Now there is just one top Store, *but* you may compose your Stores using `composeStores` higher-order Store (seriously.) |
| 189 | +* Dispatcher is now part of the public API and offers (de)hydration for isomorphic apps. |
| 190 | +* Fine-grained subscriptions via the new `<Connector select={fn}>` prop |
| 191 | +* Less surprising, more consistent API |
| 192 | + |
| 193 | +Read the discussion: https://github.com/gaearon/redux/pull/46 |
| 194 | + |
| 195 | +## [0.7.0] - 2015/06/06 |
| 196 | +* Change second parameter in callback-style action creator from `state` to `read: (Store) => state` (#44) |
| 197 | +* Rename: `Container -> Injector, @container -> @inject, Root -> Dispatcher, @root -> @dispatch` (#20) |
| 198 | + |
| 199 | +## [0.6.2] - 2015/06/04 |
| 200 | +* `@container`'s second parameter now also accepts the `props` passed to it (#36) |
| 201 | +* `<Container />` and `<Root />` invoke their `this.props.children` functions without `this.props` context |
| 202 | + |
| 203 | +## [0.6.1] - 2015/06/04 |
| 204 | +* Fix incorrect ES6 Map usage (#35) |
| 205 | + |
| 206 | +## [0.6.0] - 2015/06/04 |
| 207 | +* Breaking change: `stores` now accepts an object, just like `actions` |
| 208 | +* Breaking change: `Container` children function signature is now `({ actions, state }) => ...` |
| 209 | +* More fine-grained `Container` props validation |
| 210 | + |
| 211 | +This fixes #22. There is no more prop shape difference between subscribing to a single or to many stores. |
| 212 | +Your container may now look like this: |
| 213 | + |
| 214 | +```js |
| 215 | +<Container stores={{ counter: stores.counterStore }} |
| 216 | + actions={{ increment, decrement }}> |
| 217 | + {({ state, actions }) => <Counter {...state} {...actions} />} |
| 218 | +</Container> |
| 219 | +``` |
| 220 | + |
| 221 | +Note that you can change the `state` shape by giving arbitrary keys to your stores. It's also easier to choose what exactly you want to pass to the component. For example, you could write `actions={actions}` instead of `{...actions}`, and get all actions in `this.props.actions`. |
| 222 | + |
| 223 | +The decorator version is changed the same way: |
| 224 | + |
| 225 | +```js |
| 226 | +@container({ |
| 227 | + actions: { increment, decrement }, |
| 228 | + stores: { counter: counterStore } |
| 229 | +}) |
| 230 | +export default class Counter { |
| 231 | +``` |
| 232 | +
|
| 233 | +It also now accepts a second `transformProps` argument to be just as expressive as the component version: |
| 234 | +
|
| 235 | +```js |
| 236 | +@container({ |
| 237 | + actions: { increment, decrement }, |
| 238 | + stores: { counter: counterStore } |
| 239 | +}, ({ actions, state}) => { ...actions, ...state })) // default shape; you can write your own |
| 240 | +``` |
| 241 | +
|
| 242 | +## [0.5.1] - 2015/06/03 |
| 243 | +* Fix the remaining dependency on the function name (#16) |
| 244 | +* Add a few early invariants |
| 245 | +
|
| 246 | +## [0.5.0] - 2015/06/03 |
| 247 | +* Store function names are no longer significant, but you have to pass an object with all your Stores to the `root` (or `Root`). Fixes https://github.com/gaearon/redux/issues/16 |
| 248 | +
|
| 249 | +```js |
| 250 | +import { root } from 'redux'; |
| 251 | +import * as stores from './stores/index'; |
| 252 | + |
| 253 | +@root(stores) |
| 254 | +export default class TodoApp { |
| 255 | +``` |
| 256 | +
|
| 257 | +```js |
| 258 | +import { root } from 'redux'; |
| 259 | +import * as stores from './stores/index'; |
| 260 | + |
| 261 | +export default class TodoApp { |
| 262 | + render() { |
| 263 | + return ( |
| 264 | + <Root stores={stores}> |
| 265 | +``` |
| 266 | +
|
| 267 | +## [0.4.0] - 2015/06/03 |
| 268 | +* Bring decorators back, now on top of the lower-level container components (https://github.com/gaearon/redux/pull/15, thanks Florent) |
| 269 | +* Require `stores` passed to `Container` to be an array |
| 270 | +* Fix build on Windows (https://github.com/gaearon/redux/pull/11, thanks Mike) |
| 271 | +* Reduce context footprint (https://github.com/gaearon/redux/pull/12, thanks Florent again!) |
| 272 | +
|
| 273 | +## [0.3.1] - 2015/06/03 |
| 274 | +* Remove old files from build |
| 275 | +
|
| 276 | +## [0.3.0] - 2015/06/03 |
| 277 | +Complete rewrite. |
| 278 | +
|
| 279 | +* **No more strings,** now using module bindings for injecting stores and actions |
| 280 | +* Only use decorator for top-level component, keep dumb components pure and testable (https://github.com/gaearon/redux/issues/5) |
| 281 | +* Remove transaction logic (will be re-implemented on top of https://github.com/gaearon/redux/issues/6) |
| 282 | +
|
| 283 | +```js |
| 284 | +// The smart component may inject actions |
| 285 | +// and observe stores using <Container />: |
| 286 | + |
| 287 | +import React, { Component } from 'react'; |
| 288 | +import { Root, Container } from 'redux'; |
| 289 | +import { increment, decrement } from './actions/CounterActions'; |
| 290 | +import counterStore from './stores/counterStore'; |
| 291 | +import Counter from './Counter'; |
| 292 | + |
| 293 | +export default class CounterContainer { |
| 294 | + render() { |
| 295 | + // stores can be a single store or an array. |
| 296 | + // actions can only be a string -> function map. |
| 297 | + // props passed to children will combine these actions and state. |
| 298 | + return ( |
| 299 | + <Container stores={counterStore} |
| 300 | + actions={{ increment, decrement }}> |
| 301 | + {props => <Counter {...props} />} |
| 302 | + </Container> |
| 303 | + ); |
| 304 | + } |
| 305 | +} |
| 306 | +``` |
| 307 | +
|
| 308 | +Minor caveat: Store function names are now significant. |
| 309 | +
|
| 310 | +## [0.2.2] - 2015/06/02 |
| 311 | +* Pass `state` as a second argument to callback-style action creators |
| 312 | +
|
| 313 | +## [0.2.1] - 2015/06/02 |
| 314 | +* Fix `@provides` not passing its props down |
| 315 | +
|
| 316 | +## 0.2.0 - 2015/06/02 |
| 317 | +* Initial public release. |
| 318 | + See examples in [README](https://github.com/gaearon/redux/blob/master/README.md) and the |
| 319 | + [examples](https://github.com/gaearon/redux/tree/master/examples) folder. |
| 320 | + Alpha quality :-) |
| 321 | +
|
| 322 | +[0.12.0]: https://github.com/gaearon/redux/compare/v0.12.0...HEAD |
| 323 | +[0.12.0]: https://github.com/gaearon/redux/compare/v0.11.1...v0.12.0 |
| 324 | +[0.11.1]: https://github.com/gaearon/redux/compare/v0.11.0...v0.11.1 |
| 325 | +[0.11.0]: https://github.com/gaearon/redux/compare/v0.10.1...v0.11.0 |
| 326 | +[0.10.1]: https://github.com/gaearon/redux/compare/v0.10.0...v0.10.1 |
| 327 | +[0.10.0]: https://github.com/gaearon/redux/compare/v0.9.0...v0.10.0 |
| 328 | +[0.9.0]: https://github.com/gaearon/redux/compare/v0.8.1...v0.9.0 |
| 329 | +[0.8.1]: https://github.com/gaearon/redux/compare/v0.8.0...v0.8.1 |
| 330 | +[0.8.0]: https://github.com/gaearon/redux/compare/v0.7.0...v0.8.0 |
| 331 | +[0.7.0]: https://github.com/gaearon/redux/compare/v0.6.2...v0.7.0 |
| 332 | +[0.6.2]: https://github.com/gaearon/redux/compare/v0.6.1...v0.6.2 |
| 333 | +[0.6.1]: https://github.com/gaearon/redux/compare/v0.6.0...v0.6.1 |
| 334 | +[0.6.0]: https://github.com/gaearon/redux/compare/v0.5.1...v0.6.0 |
| 335 | +[0.5.1]: https://github.com/gaearon/redux/compare/v0.5.0...v0.5.1 |
| 336 | +[0.5.0]: https://github.com/gaearon/redux/compare/v0.4.0...v0.5.0 |
| 337 | +[0.4.0]: https://github.com/gaearon/redux/compare/v0.3.1...v0.4.0 |
| 338 | +[0.3.1]: https://github.com/gaearon/redux/compare/v0.3.0...v0.3.1 |
| 339 | +[0.3.0]: https://github.com/gaearon/redux/compare/v0.2.2...v0.3.0 |
| 340 | +[0.2.2]: https://github.com/gaearon/redux/compare/v0.2.1...v0.2.2 |
| 341 | +[0.2.1]: https://github.com/gaearon/redux/compare/v0.2.0...v0.2.1 |
0 commit comments