Releases: pmndrs/jotai
v2.4.3
This fixes a regression in an edge case, which has existed since v2.1.1.
What's Changed
- fix(vanilla): Returning the same Promise twice from an atom getter causes Promise chaining cycle. by @iwoplaza in #2152
New Contributors
- @kalijonn made their first contribution in #2139
- @stevemolitor made their first contribution in #2150
- @iwoplaza made their first contribution in #2152
Full Changelog: v2.4.2...v2.4.3
v2.4.2
v2.4.1
There was a regression in v2.3.0, which is fixed.
What's Changed
- fix(vanilla): should recompute state after onMount by @tmkx in #2099
- fix(utils/atomWithStorage): Prevent createJSONStorage from adding subscribe method when window.Storage is not defined by @byudaniel in #2100
New Contributors
- @gerzonc made their first contribution in #2083
- @ilyapopovs made their first contribution in #2101
- @tmkx made their first contribution in #2099
- @byudaniel made their first contribution in #2100
Full Changelog: v2.4.0...v2.4.1
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