跳转到主要内容

Recoil 0.3.0

We are pleased to announce the release of Recoil 0.3.0.

New Features#

  • You can now create a RecoilRoot that falls through to the surrounding root if one exists. This lets you create re-usable components that use Recoil, yet can be used within or without the context of a larger Recoil app. (#973)
  • You can now return Recoil callbacks from selectors. (#989)

Breaking Change: Preparing for Memory Management#

The next release of Recoil will have a breaking API change. Today's release issues a console warning in development builds if you have any code that will need to be updated. Most apps will not need any code changes.

When we ship memory management, Snapshots (such as the one you get as an argument to useRecoilCallback()) will only be valid for the tick in which they are created. If you want to keep a Snapshot around for longer, you need to manually retain and then release it:

const release = snapshot.retain();
try {
await someAsyncWork(snapshot);
} finally {
release();
}

In 0.3.0, if you use a Snapshot that hasn't been retained, you will get a console warning in development. There is no change in behavior in production. In the next release, it will throw an exception, in both development and production.

Retaining Snapshots should be avoided whenever possible, because it will prevent reclaiming of memory for all atoms for as long as that Snapshot is retained. Instead, pull out just the values you need before going to async.

Bug Fixes, Performance, and Other Improvements#

  • Reduced overhead when using atomFamily. One app with thousands of atoms saw 200MB less memory usage.
  • Fix a bug where errors throws from async selectors were not caught by React error boundaries. (#998, #1017)
  • Experimental Atom Effects onSet() is no longer called when triggered from setSelf() initializing with a Promise or from the same onSet() handler. (#974, #979, #953, #986)
  • Improved support for Safari. (#967, #609)
  • Values stored in selectors are now frozen in dev mode. (#911)
  • Improved TypeScript support for Loadables.

Recoil 0.2.0

We are pleased to announce the release of Recoil 0.2.0. This release has a new, more reliable implementation of async selectors, greatly improved performance, and many bug fixes and improvements.

Recoil 0.1.1

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.

Recoil 0.0.11

Today we are releasing Recoil 0.0.11. It contains bug fixes, new features, better performance, and experimental compatibility with Concurrent Mode. Thank you so much to everyone who contributed to this release!

Recoil 0.0.10

Recoil 0.0.9 and 0.0.10 is being released with some bug fixes, TypeScript support, and a new API for Recoil Snapshots to observe, inspect, and manage global Recoil atom state. Thanks again to everyone who helped make this possible and stay tuned for more exciting developments coming soon!

Recoil 0.0.8

Today we are releasing Recoil 0.0.8. It contains bug fixes and new features. Thanks so much to everyone who contributed to this release! It's been amazing to see so many people contribute.