Welcome to Recoil version 0.1.1! This release has performance improvements and introduces several experimental features such as support for React Native, working with Snapshots outside of React, and atom effects for managing side-effects of atoms such as logging, synchronization with external stores, persistence, etc.
Also, nightly builds are now available via the nightly
branch.
Performance​
Several changes to improve Recoil's performance:
- Updates performed during
useRecoilCallback()
are now batched, which avoids copying data structures or performing updates for intermediate states. This allowed setting 5,000 atoms in a loop to go from 10s -> 25ms with some of our stress tests. (@davidmccabe) - Recoil also now avoids looking up selector values in cache if the selector's dependencies have not changed. This improved some applications with complex data-flow graphs by 30-40x. (@davidmccabe)
React Native (Experimental)​
Recoil should now work with the React Native environment. However, similar to server side rendering, it is not officially supported. (#114 - @jacques-blom, @mondaychen)
Atom Effects (Experimental)​
Effects for atoms simplifies managing side-effect policies for atoms on a per-atom basis as part of the atom()
or atomFamily()
definition. Effects can be used for interesting applications such as logging and state synchronization or persistence with external storage such as remote databases, local storage, browser URL history, etc. For example, you could use an atom as a local copy of some user state and provide an effect to subscribe to changes on a server to update the local copy and for local changes to write-through and update the server. (#680, #380, #381, #384, #385, #448, #449, #412, #591, #634, #682 — @drarmstr, @csantos4242)
Snapshots for Testing (Experimental)​
Snapshots can now be constructed outside of a React context. This can be useful for testing or evaluating selectors outside of a React context. (#649 — @drarmstr, @habond)
Bug Fixes​
- This update has various bug fixes for testing and infrastructure. (#555, #587, #588, #590, #635, #631, #683, #684, #686 — @aaronabramov, @mondaychen, @drarmstr, @mallchel, @davidmccabe, @csantos4242)
- Do not freeze objects which should not be frozen. (#597, #633, #672 — @RinGoku, @a-sane)
- TypeScript typing for
Snapshot
. (#687 — @kevinfrei, @drarmstr, @habond) - Additional testing for
waitForAll()
concurrency. (#681 — @drarmstr)
Future Work​
In a future release, Recoil will automatically free the memory used by atoms and selectors that are no longer used, and will perform better with larger numbers of atoms. (@davidmccabe)
Releasing our prototype Chrome developer tools. (@maxijb)
Libraries of effects for common state persistence, such as browser local storage or URL history. (@bezi)
Thanks for your continued interest in Recoil!