Skip to content

Releases: pmndrs/jotai

v2.2.3

31 Jul 03:17
Compare
Choose a tag to compare

This comes with some small improvements.

What's Changed

  • fix: declare @types/react as peerDep to avoid phantom dep by @wjw99830 in #2048
  • fix(vanilla): check duplicated instances by @dai-shi in #2049

New Contributors

Full Changelog: v2.2.2...v2.2.3

v2.2.2

05 Jul 14:42
Compare
Choose a tag to compare

This includes some fixes for edge cases.

What's Changed

  • fix(vanilla): bail out recomputing with the same value by @dai-shi in #2016
  • fix(utils): loadable handles sync errors by @dai-shi in #2021

New Contributors

Full Changelog: v2.2.1...v2.2.2

v2.2.1

19 Jun 01:51
Compare
Choose a tag to compare

This includes some improvements in jotai/utils. Especially, unstable_unwrap is getting to be stable.

What's Changed

  • feat(utils/useHydrateAtoms) - Optionally rehydrate with force hydrate by @SariSabouh in #1990
  • fix(utils): revert atomWithStorage typing by @dai-shi in #1994
  • fix(utils): improve selectAtom typing by @dai-shi in #1995
  • fix(utils): improve unstable_unwrap for sometimes async atom by @dai-shi in #1996
  • fix(utils): unstable_unwrap to support writable atom by @dai-shi in #1997

New Contributors

Full Changelog: v2.2.0...v2.2.1

v2.2.0

12 Jun 11:03
Compare
Choose a tag to compare

It includes a few improvements. Some utils are rewritten as there was a misconception when migrating from v1. ESM builds are optimized for Vite users.

Migration Guide for jotai/utils

atomWithDefault

// suppose we have this
const asyncAtom = atom(() => Promise.resolve(1))
const countAtom = atomWithDefault((get) => get(asyncAtom))
// and in component
const setCount = useSetAtom(countAtom)

// previously,
setCount((c) => c + 1) // it worked, but it will no longer work

// instead, you need to do this
setCount((countPromise) => countPromise.then((c) => c + 1))

atomWithStorage

// suppose we have async storage
const storage = createJSONStorage(() => AsyncStorage)
const countAtom = atomWithStorage('count-key', 0, storage)
  // in component
  const [count, setCount] = useAtom(countAom)

  // previously, countAtom is a sync atom, so you could update like this:
  setCount((c) => c + 1)

  // with the new version, it becomes async occasionally, so you need to resolve it:
  setCount(async (c) => (await c) + 1)

What's Changed

  • breaking(utils): predictable atomWithDefault by @dai-shi in #1939
  • breaking(utils): improve atomWithStorage by @dai-shi in #1958
  • feat(vanilla): new store listeners for devtools by @dai-shi in #1966
  • fix(build): mode env for "import" condition" by @dai-shi in #1978

New Contributors

Full Changelog: v2.1.1...v2.2.0

v2.1.1

03 Jun 15:01
Compare
Choose a tag to compare

This version fixes some issues in edge cases.

What's Changed

  • fix(vanilla): Stable promise by @backbone87 in #1933
  • fix(vanilla): update atoms with tree structure dependencies (regression from v1) by @dai-shi in #1959
  • fix: prefer PromiseLike where appropriate by @dai-shi in #1967

New Contributors

Full Changelog: v2.1.0...v2.1.1

v2.1.0

06 May 03:54
Compare
Choose a tag to compare

This includes some improvements as well as some breaking changes in unstable features.

What's Changed

  • fix(vanilla): better promise handling by @dai-shi in #1851
  • fix(atomWithStorage): handle RESET/removeItem from cross-tab storage updates by @nderscore in #1882
  • breaking(vanilla): remove deprecated store dev methods by @dai-shi in #1893
  • fix(react): Infer useHydrateAtoms value types from atom.read ReturnType by @ericdowell in #1898
  • chore(tests): migrate to vitest by @arjunvegda in #1839

New Contributors

Full Changelog: v2.0.4...v2.1.0

v2.0.4

10 Apr 03:42
Compare
Choose a tag to compare

This includes some small improvements. One of them is to improve Deno compatibility.

What's Changed

  • fix(atomWithStorage, createJSONStorage): scope subscriptions to specified browser storage by @nderscore in #1814
  • fix(babel): improve debug label support for third-party jotai libraries by @arjunvegda in #1818
  • fix(react): atom type inference in hooks by @Thisen in #1866
  • chore: add extentsion in imports by @dai-shi in #1823

New Contributors

Full Changelog: v2.0.3...v2.0.4

v2.0.3

02 Mar 09:49
Compare
Choose a tag to compare

This release includes important features for upcoming devtools.

What's Changed

New Contributors

Full Changelog: v2.0.2...v2.0.3

v2.0.2

16 Feb 13:54
Compare
Choose a tag to compare

This version add some small improvements, mostly for some minor cases.

What's Changed

  • fix(vanilla): async derived atom not updated (race condition in an edge case) by @gimelfarb in #1768
  • fix(utils): tweak atomWithDefault types for better DX by @dai-shi in #1770
  • fix(build): UMD names by @dai-shi in #1772

New Contributors

Full Changelog: v2.0.1...v2.0.2

v2.0.1

09 Feb 14:37
Compare
Choose a tag to compare

This adds various small improvements. Docs are also updated.

What's Changed

New Contributors

Full Changelog: v2.0.0...v2.0.1