Updated changelog
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Michel Weststrate · committed by Michel Weststrate · parent 0d24494 · Browse files · 3 files·+29 added−14 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+29 added−14 removed
- tests:+14 added−0 removed
- other:+15 added−14 removed
Provenance
- Commit
8f44348- Tree
a06d9bf- Author
Michel Weststrate <mweststrate@gmail.com>- Committer
Michel Weststrate <mweststrate@gmail.com>- Parent
0d24494
3 files changed+29 added−14 removed
modified:__tests__/base.js+14 added
209 unmodified lines210 expect(baseState.aProp).toBe("hi")211 expect(nextState.aProp).toBe("hello")212 })213 214+ it("should revoke the proxy of the baseState after immer function is executed - 2", () => {215+ let proxy216+ const nextState = immer(baseState, s => {217+ proxy = s.anObject218+ })219+ expect(nextState).toBe(baseState)220+ expect(() => {221+ proxy.test = "Hallo"222+ }).toThrowError(/^Cannot perform.*on a proxy that has been revoked/)223+ expect(() => {224+ const test = proxy.test225+ }).toThrowError(/^Cannot perform.*on a proxy that has been revoked/)226+ })227+228 afterEach(() => {229 expect(baseState).toBe(origBaseState)230 expect(baseState).toEqual(createBaseState())231 })14 unmodified linesadded:changelog.md+14 added
1234567891011121314# Changelog
### 0.1.0 (1-1-2018)
* Fixed `immer` function export, it is now properly exposed as the `default` export. So `import immer from "immer"`. See [#15](https://github.com/mweststrate/immer/pull/15)* Immer now automatically freezes any state modifications made. Turn this is using `setAutoFreeze(false)` for more efficiency in production builds. See [#15](https://github.com/mweststrate/immer/pull/15)* Added support for frozen state trees in strict mode. See [#15](https://github.com/mweststrate/immer/pull/15)* `immer` will now warn if you accidentally return something from the _thunk_. Fixes [#] through [#16](https://github.com/mweststrate/immer/pull/16/). By [Gregory Assasie](https://github.com/Gregjarvez).* Proxies are now automatically cleaned up. This makes it impossible to read proxies after the `immer` function has finished. This prevents users from accidentally reading stale date. [#14](https://github.com/mweststrate/immer/pull/14) by [@benbraou](https://github.com/benbraou)
### 0.0.4 (31-12-2017)
* Added typescript typings [#11](https://github.com/mweststrate/immer/pull/11) by [@benbraou](https://github.com/benbraou)* Fixed bug when setting properties to `undefined`. Fixes [#12](https://github.com/mweststrate/immer/issues/12) through [#13](https://github.com/mweststrate/immer/pull/13) by [@benbraou](https://github.com/benbraou)modified:readme.md+1 added-14 removed
12334567151 unmodified linesExpand all159160161162163164165166167168169170171172173174175# Immer
_Your personal assistant for creating your next immutable state__Create the next immutable state tree by simply modifying the current tree_
---
Immer (German for: always) is a tiny package that allows you to work with immutable state in a more convenient way.151 unmodified linesExpand all## Pitfalls:
* Make sure to modify the draft state you get passed in in the callback function, not the original current state that was passed as the first argument to `immer`!* Since immer uses proxies, reading huge amounts of data from state comes with an overhead. If this ever becomes an issue (measure before you optimize!), do the current state analysis before entering the `immer` block or read from the `currentState` rather than the `draftState`
## Changelog
### 0.0.5
* Fixed `immer` function export, it is now properly exposed as `default`* Immer now automatically freezes any state modifications made. Turn this is using `setAutoFreeze(false)`* Added support for frozen state trees in strict mode.
### 0.0.4 (31-12-2017)
* Added typescript typings [#11](https://github.com/mweststrate/immer/pull/11) by [@benbraou](https://github.com/benbraou)* Fixed bug when setting properties to `undefined`. Fixes [#12](https://github.com/mweststrate/immer/issues/12) through [#13](https://github.com/mweststrate/immer/pull/13) by [@benbraou](https://github.com/benbraou)