Skip to content

Releases: jotaijs/jotai-effect

v1.0.2

24 Aug 23:04
458b14e
Compare
Choose a tag to compare
  • Addresses a compatibility issue with jotai@2.9.0 that caused atomEffects to lose their dependencies during recomputations.
  • Introduces a new utility helper withAtomEffect

Usage

const anAtom = atom(0)

// the effect is automatically added to the resulting atom
// setting the resulting atom is forwarded to the atom passed in
const anAtomWithEffect = withAtomEffect(anAtom, (get, set) => {
  console.log(`anAtom value is now ${get(anAtom)}`)
})
...
const [value, setValue] = useAtom(anAtomWithEffect)

v1.0.0

06 Apr 22:38
Compare
Choose a tag to compare

I am thrilled to announce the release of Jotai Effect version 1.0! This milestone represents a significant achievement marking its readiness for production use.

Jotai Effect was started last October with the aim of providing a utility package for reactive side effects within the Jotai ecosystem. Over the past six months, I have been closely monitoring the API's stability and its effectiveness in real-world applications.

For those eagerly waiting for Jotai to be considered production-ready, the moment has finally arrived. The feedback from our community has been overwhelmingly positive, and today, I'm confident that Jotai Effect is ready for its prime time.

I couldn't have reached this point without the help of our amazing contributors, Daishi Kato (@dai-shi) and Alex Yang (@himself65). Their early contributions were pivotal in honing the library to what it is today. Additionally, I want to extend my gratitude to our vibrant community on Discord for their continuous support and feedback.
Thank you.

As we celebrate this release, I encourage you to explore Jotai Effect and discover how it can streamline your reactive programming workflows. Happy Coding!

Best regards,
David Maskasky

The full discussion can be viewed here.

v0.6.0

29 Feb 11:00
Compare
Choose a tag to compare

What's Changed

  • rethrow errors thrown during effectFn and cleanup by @dmaskasky in #33

Full Changelog: v0.5.0...v0.6.0

v0.5.0

01 Feb 21:37
Compare
Choose a tag to compare

Adds support for reading an atom's value without subscribing to it.

Read atom data without subscribing to changes with get.peek.

const countAtom = atom(0)
atomEffect((get, set) => {
  // will not rerun when countAtom changes
  const count = get.peek(countAtom)
})

What's Changed

  • feat: get.peek reads atom value without subscribing to updates by @dmaskasky in #30

Full Changelog: v0.4.0...v0.5.0

v0.4.0

25 Jan 01:23
Compare
Choose a tag to compare

Adds support for recursion. 🥳

Recursion is supported with set.recurse for both sync and async use cases, but is not supported in the cleanup function.

const countAtom = atom(0)
atomEffect((get, set) => {
  // increments count once per second
  const count = get(countAtom)
  const timeoutId = setTimeout(() => {
    set.recurse(countAtom, increment)
  }, 1000)
  return () => clearTimeout(timeoutId)
})

What's Changed

Full Changelog: v0.3.2...v0.4.0