Skip to main content

Recoil 0.5

· One min read

Welcome to Recoil 0.5 with a few new APIs and improvements.

Hook for refreshing selectors​

The useRecoilRefresher_UNSTABLE() hook has been added for refreshing selectors that execute data queries. This is useful if you just want to refresh for newer data or retry due to an error. (#972, #1294, #1302)

Atom effect improvements​

  • Add isReset parameter to onSet() callback to know if the atom was reset. (#1358, #1345)
  • Add getLoadable(), getPromise(), and getInfo_UNSTABLE() for reading other atoms. (#1205, #1210)

Loadable factories​

The RecoilLoadable interface is now available for making your own Loadable objects. (#1263, #1264, #1312)

Other fixes and improvements​

  • Allow class instances in family parameters for Flow (#1215)
  • Loadable improvements:
    • Ability to map Loadables with other Loadables. (#1180)
    • Re-implement Loadable as classes. (#1315)
  • Fix user-thrown promises in selectors for some cases.
  • Improved dev-mode checks:
    • Atoms freeze default, initialized, and async values. Selectors should not freeze upstream dependencies. (#1261, #1259)
    • Perform runtime check that required options are provided when creating atoms and selectors. (#1324)
  • Upgrade Prettier version (#1366)

Also lots of restructuring in preparation for the upcoming recoil-sync library release...