Skip to content

Releases: pmndrs/jotai

v2.9.0

09 Jul 03:20
Compare
Choose a tag to compare

This version introduces a new core implementation. All tests are passing but there can be some regressions due to missing tests. Please feel free to report such cases and let's improve test coverage.

The benefit with the new implementation:

  • Fix memory leak issue with vanilla store usage.
  • More readability of the core code.

What's Changed

Full Changelog: v2.8.4...v2.9.0

v2.8.4

28 Jun 03:54
Compare
Choose a tag to compare

This changes the behavior of async atom with abort signal on unmount to fix some use cases.

What's Changed

New Contributors

Full Changelog: v2.8.3...v2.8.4

v2.8.3

03 Jun 14:23
Compare
Choose a tag to compare

The improvement for atomWithStorage in v2.8.2 contained a bug, which is fixed in this version.

What's Changed

  • fix(utils): subscribe method of createJSONStorage should only run in the client by @mhsattarian in #2585
  • feat(store2): add dev4_get_mounted_atoms by @arjunvegda in #2594

New Contributors

Full Changelog: v2.8.2...v2.8.3

v2.8.2

27 May 11:58
Compare
Choose a tag to compare

This fixes another edge case and improves utils for more flexibility.

What's Changed

  • fix(store2): "stuck" derived atoms where some derivations may never resolve by @backbone87 in #2448
  • feat(utils): allow providing a subscribe method to createJSONStorage util by @mhsattarian in #2539
  • fix(vanilla): fix store.ts for an edge case by @dai-shi in #2567

New Contributors

Full Changelog: v2.8.1...v2.8.2

v2.8.1

22 May 01:33
Compare
Choose a tag to compare

This fixes a regression in v2.6.4 and a regression in v2.7.0.

What's Changed

  • feat: add back dev4_restore_atoms to store v2 by @arjunvegda in #2509
  • fix(core): update atom value with conditional dependencies (regression with #2363) by @probeiuscorp in #2534
  • fix(store): properly update atom values with edge-case dependency by @dai-shi in #2555

New Contributors

Full Changelog: v2.8.0...v2.8.1

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