v7.0.0
☄️ Support for Effector v23
This release allows usage of effector-storage
with effector
v23, but is not yet introducing advanced types support.
Full-featured support of effector
v23 will come later.
⬆️ Adjusted update
function signature and behaviour
🐛 Fixed types declarations for package (publint)
BREAKING:
❗ Removed deprecated adapters for React Native AsyncStorage and EncryptedStorage adapters (use @effector-storage/react-native-async-storage and @effector-storage/react-native-encrypted-storage instead)
💥 Minimal supported effector
version bumped to 22.4.0
💥 Drop support for Nodejs 16
Note for SSR and scope
users
Prior to version 23 effector took current value of a store in the scope on a first read. Due to this behavior it was possible to completely ignore scopes with effector-storage
as long as you do not need asynchronous updates from the storage.
// effector 22 compatible code
const $store = createStore(0)
persist({ store: $store }) // restores 42
const scope = fork()
const x = scope.getState($store) // x === 42
But in version 23 this behavior was changed due to not obviousness and as leading to some issues (see issue #535 and PR #909). So now state of a store in the scope will always be initial on a first read.
// in effector 23
const $store = createStore(0)
persist({ store: $store }) // restores 42
const scope = fork()
const x = scope.getState($store) // x === 0 !!!
Now, in order to use effector-storage
with scopes in effector 23, you should always use pickup
event! It aligns with recommendation to use explicit start of an application. It will also correctly handle asynchronous updates from the storage, binding those updates to correct scope.
If you have many persist
calls across your entire application, you could take advantage of createPersist
factory:
// import this `persist` everywhere instead
export const persist = createPersist({
pickup: appStarted
})