Skip to content

v1.7.0

Compare
Choose a tag to compare
@dai-shi dai-shi released this 28 May 13:49
· 736 commits to main since this release

Prior to this version, Provider catches all atoms for useDebugValue in development mode for React DevTools. One issue is that you can’t disable this behavior. The other limitation is this doesn’t work with provider-less mode. To this end, we expose a new hook useAtomsDebugValue and remove the feature from Provider. Migration is required if you are using Provider and React DevTools to see atom values in development mode.

Migration Guide

Previously, if you use <Provider>, useDebugValue is automatically used in the dev mode and you can never disable it.

import { Provider } from 'jotai'

const Root = () => (
  <Provider>
    <App />
  </Provider>
}

Now, to get the same behavior, you need to use the useAtomsDebugValue explicitly.

import { Provider } from 'jotai'
import { useAtomsDebugValue } from 'jotai/devtools'

const DebugAtoms = () => {
  useAtomsDebugValue()
  return null
}

const Root = () => (
  <Provider>
    <DebugAtoms />
    <App />
  </Provider>
}

What's Changed

  • fix(utils): fix memory leaks and other issues in atomWithObservable by @TobiasWalle in #1170
  • refactor(urql): atomWithQuery with fixing tests by @dai-shi in #1179
  • feat(devtools): expose useAtomsDebugValue from jotai/devtools by @dai-shi in #1184

Full Changelog: v1.6.7...v1.7.0