Releases: davidgilbertson/react-recollect
Releases · davidgilbertson/react-recollect
v4.0.3
Downgrades the errors when a user reads from or writes to the 'wrong' store. These are now a console.error
rather than throw Error()
.
v4.0.2
Fixes an issue server-rendering with Next.js
v4.0.1
Fixes ReferenceError: window is not defined
in Node.js.
v4.0.0
New stuff
- The new
batch
function allows making multiple changes to the store, while only triggering a single update to components. - Support for
Map
andSet
objects in the store. - Support for
Symbol
keys - Simplified ref forwarding. The complicated
forwardRef
logic has been removed. Instead, to pass a ref into a component wrapped incollect
, just use a prop name other thanref
.
Breaking changes
- The shape of the event object passed to the
afterChange
callback has changed.- Prop paths are now arrays. E.g. if a task was marked as done, the 'path' of this change would be
['tasks', 2, 'done']
, whereas previously it wasstore.tasks.2.done
. - The
components
prop has been renamed toupdatedComponents
- The
propPath
prop has been renamed tochangedProps
, and is now an array of all changed paths that triggered an update.
- Prop paths are now arrays. E.g. if a task was marked as done, the 'path' of this change would be
- Updating the store during a render (technically, a collection cycle) now results in an error. This includes code in
componentDidMount()
. This should help catch subtle bugs.
Other stuff
- Recollect is now 100% TypeScript
v3.1.2
3.1.2
v3.1.0
A significant performance improvement under some circumstances.
For example, if you had a large array of stock prices and fetch an update from the network and apply it to the store. You want to apply the new data to each one, but some prices may be the same as the previous value.
Now, if an update would have no effect it's short circuited and the store object isn't even updated.
Tests in tests/unit/nonReactStatics.test.js
v3.0.0
- Condensed the
afterChange
callback parameters into a single object - Fixed a bug when setting the store multiple times in a event handler (e.g.
onClick
) - Allow passing a ref to a collected component
v2.4.0
- Now works with server-side rendering, with a new function
initStore
.
v2.3.0
- Hoist non-react statics
- Include
index.d.ts
in the npm package - Add docs for 'selector pattern'
v2.2.1
- Fixed bug with setting properties in
componentDidMount
to triggering a re-render. - Added docs for project organization and the updater pattern
- Cleaner logging