Releases: pmndrs/jotai
v2.4.0
This version fixes an edge case in core that has existed since v2.0.0.
What's Changed
- fix(vanilla): should only mount dependencies if the atom is mounted by @dai-shi in #2078
- fix(vanilla): should update with conditional dependencies by @dai-shi in #2086
- fix(utils): Do not set a splitted atom when not actually modified by @arnodb in #2088
New Contributors
Full Changelog: v2.3.1...v2.4.0
v2.3.1
There was a bug in #2061, which is fixed. It's about a dev-only warning.
What's Changed
New Contributors
- @ivoberger made their first contribution in #2065
- @fz6m made their first contribution in #2066
Full Changelog: v2.3.0...v2.3.1
v2.3.0
Jotai v2's store API is framework-agnostic. The primary use case is for React, but the store can be used for other frameworks. One of the difficulties was handling promises, and there has been unstable_unwrap
util since Jotai v2.0.0. Now, it's considered stable and becomes unwrap
util (see docs for details).
What's Changed
- refactor(vanilla): simplify store impl by @dai-shi in #2029
- breaking: remove deperecated dev-only methods by @dai-shi in #2054
- feat(utils): stable unwrap by @dai-shi in #2055
- fix(vanilla): improve warning message for multiple instances by @dai-shi in #2061
Full Changelog: v2.2.3...v2.3.0
v2.2.3
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
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
- @vossmalte made their first contribution in #2006
Full Changelog: v2.2.1...v2.2.2
v2.2.1
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
- @SariSabouh made their first contribution in #1990
Full Changelog: v2.2.0...v2.2.1
v2.2.0
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
- @reinierkaper-carewell made their first contribution in #1980
Full Changelog: v2.1.1...v2.2.0
v2.1.1
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
- @blissdev made their first contribution in #1945
- @hwanyoungChoi made their first contribution in #1957
- @alexhad6 made their first contribution in #1971
- @backbone87 made their first contribution in #1933
Full Changelog: v2.1.0...v2.1.1
v2.1.0
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
- @lloydrichards made their first contribution in #1865
- @todorone made their first contribution in #1878
- @eikonomega made their first contribution in #1885
- @milhamm made their first contribution in #1903
- @RIP21 made their first contribution in #1907
- @ericdowell made their first contribution in #1898
Full Changelog: v2.0.4...v2.1.0
v2.0.4
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
- @Etesam913 made their first contribution in #1810
- @haywirez made their first contribution in #1828
- @amirhhashemi made their first contribution in #1830
- @Fonger made their first contribution in #1835
- @satyamgupta1495 made their first contribution in #1825
- @FoundTheWOUT made their first contribution in #1846
- @nderscore made their first contribution in #1814
- @manakuro made their first contribution in #1860
Full Changelog: v2.0.3...v2.0.4