Skip to content

Releases: pmndrs/jotai

v2.8.0

08 Apr 04:15
Compare
Choose a tag to compare

This version introduces a new feature atomWithLazy and deprecates useReducerAtom and freezeAtomCreator. It also introduces an experimental store implementation in jotai/experimental.

Migration Guide

selectAtom

selectAtom will no longer internally unwrap promises. To migrate to the new api, use the unwrap utility from jotai/utils package.

// suppose we have this
const baseAtom = atom(Promise.resolve({ id: 0, name: 'test' }))

// previously selectAtom would internally unwrap promises.
const idAtom = selectAtom(
  baseAtom,
  ({ name }) => name,
  (prev, curr) => prev.id === curr.id
)

// instead, you need to import `unwrap` from 'jotai/utils' and pass the unwrapped atom 
import { unwrap } from 'jotai/utils'
  ...
const idAtom = selectAtom(
  unwrap(baseAtom),
  ({ name }) => name,
  (prev, curr) => prev.id === curr.id
)

useReducerAtom

https://jotai.org/docs/recipes/use-reducer-atom

freezeAtomCreator

https://jotai.org/docs/guides/debugging#freezeatomcreator

What's Changed

New Contributors

Full Changelog: v2.7.2...v2.8.0

v2.7.2

29 Mar 12:16
Compare
Choose a tag to compare

Mostly refactors.

What's Changed

Full Changelog: v2.7.1...v2.7.2

v2.7.1

15 Mar 05:45
Compare
Choose a tag to compare

This fixes a regression in v2.7.0.

What's Changed

  • fix(vanilla): store should flush pending write triggered asynchronously and indirectly by @iwoplaza in #2451
  • fix(utils): atomWithStorage to always run onMount by @dai-shi in #2455

New Contributors

Full Changelog: v2.7.0...v2.7.1

v2.7.0

28 Feb 03:53
Compare
Choose a tag to compare

We've improved the use of WeakMap for better memory management. Please report to us if any regressions are found.

What's Changed

  • feat: atomWithRefresh by @dai-shi in #2393
  • refactor: make pendingMap a WeakMap for better memory management by @dai-shi in #2396
  • fix(utils): make 'unwrap' and 'loadable' able to access async atom's resolved value immediately by @iwoplaza in #2417
  • fix(types): withStorageValidator by @dai-shi in #2418
  • build: change rollup target to ES2018 by @amirhhashemi in #2419

Full Changelog: v2.6.5...v2.7.0

v2.6.5

21 Feb 15:46
Compare
Choose a tag to compare

Some type improvements!

What's Changed

  • fix(types): useAtom with one type argument for primitive atoms by @dai-shi in #2386
  • fix(types): fix withStorageValidator type by @dai-shi in #2410

New Contributors

Full Changelog: v2.6.4...v2.6.5

v2.6.4

31 Jan 15:38
Compare
Choose a tag to compare

Performance improvement! Check it out!

What's Changed

New Contributors

Full Changelog: v2.6.3...v2.6.4

v2.6.3

24 Jan 12:08
Compare
Choose a tag to compare

Some improvements in core and utils 👏

What's Changed

  • fix: atoms should not remount on recalculations (with async dependencies) by @dmaskasky in #2347
  • fix(utils): atomWithReducer for jotai-scope by @dai-shi in #2351
  • fix(utils/atomWithStorage): defaultStorage with disabled local storage crashes on mount by @benediktschlager in #2354
  • feat(vanilla): customizable atom.unstable_is by @dai-shi in #2356

New Contributors

Full Changelog: v2.6.2...v2.6.3

v2.6.2

16 Jan 05:58
Compare
Choose a tag to compare

Some improvements for atomWithStorage. Feedback is welcome.

What's Changed

  • fix(vanilla): should mount once with atom creator atom by @nogaten in #2319
  • feat(utils): createJSONStrage options by @dai-shi in #2324
  • feat(utils): add withStorageValidator by @dai-shi in #2336

New Contributors

Full Changelog: v2.6.1...v2.6.2

v2.6.1

28 Dec 15:30
Compare
Choose a tag to compare

This version has two minor improvements for library authors. It's wonderful to see Jotai ecosystem growing. No major bugs have been reported lately. It's fairly okay to say the current version is pretty stable.

What's Changed

New Contributors

Full Changelog: v2.6.0...v2.6.1

v2.6.0

25 Nov 02:34
Compare
Choose a tag to compare

We can now directly use <Provider> in React Server Components. 🎉

What's Changed

  • feat(build): set some files to the client only for React Server Components use case by @himself65 in #2245
  • feat(utils): getOnInit option for atomWithStorage by @dai-shi in #2246

New Contributors

Full Changelog: v2.5.1...v2.6.0