Releases: RisingStack/react-easy-state
v6.1.2
v6.1.1
Fixes
- Fixed a critical issue with React hooks. Please upgrade to this patch when you upgrade React from v16.8 alpha to v16.8 stable.
v6.1.0
Changes
-
Automatic sync batching was added for native DOM event handlers to improve performance.
-
Rewrote the batching implementation to use React's
unstable_batchedUpdates
.-
Components will no longer render twice if a related store and their props are both changed in a single sync batch.
-
Components are always rendered in a parent-child order in a single batch.
-
The
batch
function is just an alias ofunstable_batchedUpdates
.
-
-
Fixed a bug with ES6 Maps and Sets, where object values with nested data were not reactive sometimes.
-
Tests are wrapped with
<StrictMode>
to guarantee the compatibility with tomorrow's React. -
Added a React Native example and test coverage for React Native.
-
Added typings for the
batch
function. (Thanks to moritzuehling) -
Improved docs.
v6.0.6
Fixes
- Fixed incorrect 'this' value in auto batched methods (like
websocket.onmessage
)
v6.0.5
Fixes
- Fix a React Native crash: #58 (thanks @stephanlough !)
v6.0.4
Fixes
Added automatic batching to WebSocket handlers
v6.0.3
Critical Fix
- Fixed Easy State breaking Promises and timers
v6.0.2
Fixes
- Fixed a build issue
v6.0.1
Features
- Added the
batch
function to manually batch updates.
Fixes
- Added auto batching to requestAnimationFrame and requestIdleCallback.
v6.0.0
Breaking changes
Changed the default bundle to ES6 (from the previous ES5 one). The project uses none polyfillable ES6 Proxies, so the ES5 build was only defaulted to support older toolchains (bundler/minifier). If you use an older toolset please follow this docs section to learn how to use the older ES5 build.
create-react-app 2 and webpack 4 should both work with the ES6 build.
Features
Added sync batching for the most common task sources for better performance. This removes the necessity of following this docs section for performance upgrades. The docs section will be removed soon.
easy-state is using vanilla setState
calls behind the scenes, which has a limited batching functionality at the moment. easy-state usage usually includes a lot of data manipulation, which results in multiple setState
calls. To avoid multiple re-renders easy-state now has built-in synchronous batching for common task sources (timers and promises). The below example demonstrates this:
import { store, view } from 'react-easy-state'
const clock = store({ time: new Date() })
setInterval(() => {
clock.time = new Date()
clock.time = new Date()
}, 1000)
const Clock = view(() => <div>clock.time.toString()</div>)
easy-state v5 would render Clock
two times every second, because clock.time
is set two times. easy-state v6 renders clock.time
once every second, because it has a synchronous batching. In general a single synchronous block of code renders components only once.
NOTE: This batching will be removed in favor of React's own batching when it is released (hopefully in React 17).