Releases: facebookexperimental/Recoil
Releases · facebookexperimental/Recoil
0.7.7
- Fix potential unhandled promise rejection in useRecoilCallback() (#2075)
- Add OSS support for GateKeeper feature toggling via RecoilEnv.RECOIL_GKS_ENABLED (#2078)
- Fix resolving suspense of async selectors used with SSR (#2073, #1960)
- Fix SSR with some versions of React DOM used with Next.JS 13 (#2082, #2086)
0.7.6
- Expose flag to disable "duplicate atom key" checking / logging, as it was too noisy in environments such as NextJS or some dev environments using Fast Refresh. (#733, #2020, #2046)
- Import RecoilEnv from the recoil package, and set
RecoilEnv.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED = false
in code to disable the checking and logging. - We also support
process.env.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false
in NodeJS environments such as NextJs - Caution: This disables all checks for duplicate atom keys including legitimate errors, so use with caution!
- Import RecoilEnv from the recoil package, and set
- Workaround for React 18 environments with nested renderers that don't support useSyncExternalStore(). (#2001, #2010)
0.7.5
0.7.4
0.7.3
- Enable atoms and selectors to be used in family parameters (#1172)
- Add
parentStoreID_UNSTABLE
to atom effects which is the ID of the parent store it cloned from, such as the host<RecoilRoot>
store foruseRecoilCallback()
snapshots. (#1744) - Atom effects can initialize or set atoms to wrapped values (#1681)
0.7.2
0.7.1
Typing
- Add explicit
children
prop to<RecoilRoot>
anduseRecoilBridgeAcrossReactRoots_UNSTABLE()
for TypeScript for@types/react
with React 18 (#1718, #1717, #1726, #1731) - Update typing for family parameters to better support Map, Set, and classes with
toJSON()
. (#1709, #1703)
Fixes
- Avoid dev-mode console error with React 18 when using shared async selectors across multiple
<RecoilRoot>
's. (#1712) - Cleanup potential memory leak when using async selectors. (#1714)
- Fix potentially hung async selectors when shared across multiple roots that depend on atoms initialized with promises that don't resolve. (#1714)
0.7.0
New Features
- The
default
value is now optional foratom()
andatomFamily()
. If not provided the atom will initialize to a pending state. (#1639) - Add
getStoreID()
method toSnapshot
(#1612) - Publish
RecoilLoadable.loading()
factory for making an asyncLoadable
which never resolves. (#1641)
Breaking Changes
- Selector's
get()
and Atom'sdefault
can now accept aLoadable
to put the node in that state. If you wish to store aLoadable
,Promise
, orRecoilValue
directly you can wrap it withselector.value()
oratom.value()
. (#1640) useRecoilCallback()
now provides a snapshot for the latest state when the callback is called instead of the latest rendered state, which had issues (#1610, #1604)
Improvements / Optimizations
- Automatically retain snapshots for the duration of async callbacks. (#1632)
- Optimization for more selector dependencies. 2x improvement with 100 dependencies, 4x with 1,000, and now able to support 10,000+. (#1651, #1515, #914)
- Better error reporting when selectors provide inconsistent results (#1696)
Fixes
0.6.1
0.6.0
React 18
- Leverage new React 18 APIs for improved safety and optimizations. (#1488)
- Fixes for
<StrictMode>
(#1473, #1444, #1509). - Experimental support for
useTransition()
using hooks with_TRANSITION_SUPPORT_UNSTABLE
suffix. (#1572, #1560) - Recoil updates now re-render earlier:
- Recoil and React state changes from the same batch now stay in sync. (#1076)
- Renders now occur before transaction observers instead of after.
New Features
- Add
refresh()
to theuseRecoilCallback()
interface for refreshing selector caches. (#1413) - Callbacks from selector's
getCallback()
can now mutate, refresh, and transact Recoil state, in addition to reading it, for parity withuseRecoilCallback()
. (#1498) - Recoil StoreID's for
<RecoilRoot>
andSnapshot
stores accessible viauseRecoilStoreID()
hook (#1417) orstoreID
parameter for atom effects (#1414). RecoilLoadable.all()
andRecoilLoadable.of()
now accept either literal values, async Promises, or Loadables. (#1455, #1442)- Add
.isRetained()
method for Snapshots and check if snapshot is already released when using.retain()
(#1546)
Other Fixes and Optimizations
- Reduce overhead of snapshot cloning
- Fix transitive selector refresh for some cases (#1409)
- Fix some corner cases with async selectors and multiple stores (#1568)
- Atom Effects
- Run atom effects when atoms are initialized from a set during a transaction from
useRecoilTransaction_UNSTABLE()
(#1466, #1569) - Atom effects are cleaned up when initialized by a Snapshot which is released. (#1511, #1532)
- Unsubscribe
onSet()
handlers in atom effects when atoms are cleaned up. (#1509) - Call
onSet()
when atoms are initialized with<RecoilRoot initializeState={...} >
(#1519, #1511)
- Run atom effects when atoms are initialized from a set during a transaction from
- Avoid extra re-renders in some cases when a component uses a different atom/selector. (#825)
<RecoilRoot>
will only callinitializeState()
once during the initial render. (#1372)- Lazily compute the properties of
useGetRecoilValueInfo_UNSTABLE()
andSnapshot#getInfo_UNSTABLE()
results (#1549) - Memoize the results of lazy proxies. (#1548)
Breaking Changes
- Rename atom effects from
effects_UNSTABLE
to justeffects
, as the interface is mostly stabilizing. (#1520) - Atom effect initialization takes precedence over initialization with
<RecoilRoot initializeState={...} >
. (#1509) useGetRecoilValueInfo_UNSTABLE()
andSnapshot#getInfo_UNSTABLE()
always report the nodetype
. (#1547)- The 0.3 release introduced the need to retain Snapshots for later use, but it was mostly a warning. Now it is necessary to retain a Snapshot for asynchronous selectors to resolve. See the documentation here and here. Future releases will further enforce this as garbage collection is released.