23.2.3
- Fix types for
attach({ effect })
, allowing to pass explicitname
in this overload (issue #1000)
attach({ effect })
, allowing to pass explicit name
in this overload (issue #1000) allSettled
calls with derived units. This case was labeled as a type error, but was forgotten in runtime. EventCallable
, StoreWritable
and UnitTargetable
types to allow users to express and understand what could be updated or called directly and what could not. Now createStore
returns StoreWritable
which can be passed to sample target and combine
returns Store
which will show type and runtime error (PR #966)addLoc: true
in babel-plugin. Usually the one wanted to enable this in development only so addLoc
plugin option is disabled by default (PR #1015)batch
option to createWatch
(PR #850)@withease/factories
to babel-plugin defaults (PR #995)patronum
modules to babel-plugin defaults (PR #996)greedy
to batch
in sample
. greedy: true
becomes batch: false
which is a better mental model for what this option do (PR #972)merge
and restore
(PR #969)domain
to be used in attach
without parent effect (PR #895) .reinit
, now it exists in StoreWritable
and not exists in Store
(PR #966)combine
calls (PR #916)attach
(PR #1011) skipVoid: true
option in combine
and map
to enable old behavior. Getting rid of that edge case will allow to introduce lazy computations (issue #920)forward
and guard
in favor of sample
(PR #913)reactSsr
option in babel-plugin (PR #910)onlyChanges
option in serialize
(PR #907){[fx.sid]: Function}
in fork handlers
(PR #973).watch
with second argument in favor of sample
(PR #906).getType()
- relic from ancient times which exists for redux compatibility (PR #899)effector/babel-plugin-react
(PR #948)fork(domain)
and hydrate(domain)
- this api existed for traking units in scopes when Fork API was introduced, but starting from 22 version this is done automatically and domain is no longer required for that (PR #950) fn
in $store.map(fn)
returns undefined
in the initialization (issue #828) effector/fork
module (PR #842)createStoreObject
alias for combine
(PR #908).thru
method (PR #843)$store.map
(PR #846)restore($store)
support. This was an obscure feature when store is passed to method and returned without changes as is (PR #1018) UnitTargetable
, EventCallable
and StoreWritable
as aliases to improve migration experience and ecosystem compatibility combine
function called twice on first allSettled
call (PR #984) 22.8.2
: now combine
in tuple-form handles compelx edge-cases with mapped stores correctly. (PR #902) 22.8.4
: now fix works for fork({ handlers })
calls too. PR #898 fork
calls without sid (function from release 22.8.0
). Some libraries provide built-in sid’s in the code, which led to the duplicated sid found
exception when calling fork
when trying to use two instances of the same factory in a test and running it without effector/babel-plugin
. The exception on fork
calls is no longer thrown, and all sid-related checks and assertions have been moved to serialize
calls, since sid’s are actually only required for serialize
to work. PR #897 fork({ values, handlers })
, which allows to run tests without effector/babel-plugin
. Note, that plugin and sids are still required for SSR. (PR #855) Declaration
type, provide missing top-level properties for region
and factory
typesid
to Declaration
type withRegion
exports
definition for effector/inspect
API serialize: "ignore"
in fork({ values })
(PR #862) allSettled(scope)
feature. source
. This case now supported and typechecked correctly: Note that the one need to use “as const” in that case to got correct typechecking because without it typescript cannot infer the type [Store<string>, Store<number>]
. We are working to avoid that limitation, stay tuned!
store.reinit
event to set default value into store (PR #797) is.attached
method to detect effects created via attach
(PR #670)Gate
to be serialized (as this requires changes in babel plugin) (PR #683) filter
option to sample
, thereby making guard
an alias (issue #521) clock
option to split
(issue #537) sample
type checking:split
type checking:sample
, guard
, split
and forward
are deprecated (issue #563)merge
, sample
and split
are deprecatedrestore($store)
is deprecated (issue #571)attach
got correct name for use in developer tools like effector-logger (issue #527)sample/guard
pass obsolete data from it’s source
store (issue #544)combine
with fork api (issue #613)effector/babel-plugin
changes function calls which it should avoid (issue #603)effector/babel-plugin
(issue #601)combine
support for units with large union types (issue #531)Event<unknown>
(PR #454)effector/babel-plugin
in patronum/macro
.on
and .reset
methods debugSids
to effector/babel-plugin
The option allows adding file path and variable name to a sid for each unit definition. It allows to easily debug serialized scope using SSR.
attach({source, async effect(source, params) {}})
const scope = fork()
Unit not found in scope
error is no longer exists, any unit could be used in any scopefork
and serialize
a hundredfoldfork({values: [[$user, 'alice'], [$age, 22]]})
serialize: 'ignore'
option to createStore
to declare store as ignored by serialize
callsonlyChanges: true
a default serialize
optioncombine
arguments and throw an error in case of undefined
and non-store units (issue #509)createStoreObject
alias for combine
effector/fork
module.thru
store.map
.on
in derived stores created by store.map
and combine
event.map
, event.filterMap
and event.filter
fx.done
, fx.doneData
and other events belongs to effectsɔ
(latin small letter open o) symbol to prevent incorrect unicode parsingscope.find
which is a wrong abstraction for a new forkScope
a unit:Scope
to is.unit
is.scope
methodscopeBind(unit, {scope})
, which is also can be used outside from .watch
split
. Case functions and stores will choose target case by its name, matcher stores are boolean stores which indicate whether to choose given case updateFilter
config field to createStore
to skip arbitrary store updates (discussion #428) sample
with clock
without source
. For example, it useful in cases when clock
is array of units and no source
stores is needed clock
to guard
to improve developer expirience in cases when update trigger (clock
field) and data source (source
field) are different things Add addNames
field to babel plugin (PR #450)
Add type support for Scope
to clearNode
(issue #441)
Add compositeName
to Domain
typings, making it consistent with other units
Add EventPayload
and UnitValue
type helpers (PR #434)
Improve various edge cases with fork api and serialization
Improve typechecking for attach
(issue #439)
Fix various type issues in sample
and guard
typings
factories
in effector/babel-plugin
accepts array of module names which exports will be treated as custom factories therefore each function call will provide unique prefix for sid
properties of units inside them Import createEffectStatus
from './createEffectStatus'
was treated as factory function so each store created by it has its own sid
and will be handled by serialize independently, although without factories
they will share the same sid
Add user-friendly unit name in fork api error messages when given unit is not found in scope. This improves error messages in both effector
and effector-react
Add validation for values
and handlers
fields in fork
and for values
field in hydrate
Add type support for createEffect<typeof handler, Error>(handler)
to infer Params
and Done
types from given handler
and provide custom Fail
type at the same time
createEffect and custom errors in documentation
Add support for attach({effect})
to create effect which will call effect
with params as it is. That allow to create separate effects with shared behavior (PR #396 and #397 (thanks @sergeysova and @oas89))
Add reactSsr
option to effector/babel-plugin
to replace imports from effector-react
to effector-react/ssr
. Useful for building both server-side and client-side builds from the same codebase
allSettled
. When allSettled
is called with Effect
, it return object with value
and status
fields (discussion) createEffect(handler)
Add types for domain.effect(handler)
Fix effector/babel-plugin behavior in case when methods like createStore
are imported from unrelated library and should be ignored. Import library could be defined by importName config field
Improve fork api support for watchers
createEffect(handler)
createEffect(handler) in documentation
attach({source, effect})
without mapParams
: in case with source
and effect
only, inner effect will be triggered with source
values attach({effect, source}) in documentation
it’s a shorthand for common use case:
attach
mapParams
field: errors happened in mapParams
function will force attached effect to failsplit
and createApi
name
field to attach
typings.filter
and .filterMap
to effect typings (PR #376)forward
, attach
, sample
and guard
: attempt to call these methods without arguments will lead to error with user-friendly descriptionclock
field which acts like a merge
call sample
in case of config formpackage.json
to package exports
field (read more in nodejs documentation) Add onlyChanges
option to serialize
to ignore stores which didn’t changed in fork (prevent default values from being carried over network)
Add type helpers for stores and effects: StoreValue
, EffectParams
, EffectResult
and EffectError
domain.createEffect
to infer type from given handler
(that feature was already implemented for createEffect
method), this code now typechecked as expected: allSettled
with void units without params
field, this code now typechecked as expected: split
for pattern-matching without additional forwards You can match directly to store api as well:
effector/fork
into effector
. Now all methods required for SSR are exported from the library itself, making effector/fork
an aliasScope
type alias for Fork
import {createStore} from 'effector/effector.mjs'
console.error
with undefined return, which was violating the type of effectrestore
aliases, event.filter(fn)
alias for event.filterMap(fn)
, greedy
in sample
as separate last argument and unused blocks
and Kind
attach
to domain effects, allowing these effects to be called within other effects when using fork
event.watch
watcher, this code now throw error as expected: createNode
to call without arguments Step
type alias for Node
guard
got Boolean
(a function) as filter
handlers
to fork
to change effect handlers for forked scope (useful for testing) scope.getState(store)
to access to store values in forked scopesvalues
support for fork
store.on
(PR #328) clearNode(unit)
from their parent domain hooks and history sets ignore
parameter to serialize
to skip stores during app state serialization PR #325 (thanks @sergeysova) effector/babel-plugin
when inability to determine unit name led to the absence of sid
property hydrate
allSettled
support for effects as first argument attach
: wrapper for effect, which allow to map effect arguments and use data from stores. Use cases: declarative passing values from stores to effects and argument preprocessing.
noDefaults
option for effector/babel-plugin
for making custom unit factories with clean configuration source
will become clock
as well) domain.hooks
calls as escape hatch for imperative adding units to given domain effect.doneData
and effect.failData
events with effect result and error values as shorthands for common use cases effect.done.map(({result}) => result)
and effect.fail.map(({error}) => error)
Documentation for effect.doneData
Documentation for effect.failData
effect.inFlight
store to effects. It show how many effect calls aren’t settled yet. Useful for rate limiting. Documentation for effect.inFlight
withRegion
: region-based memory management tool, which attach units (stores, events and effects) and watchers, created inside given callback to lifecycle of owner unit to be erased together with it. Map<Store, any>
to values
property in fork
.effect.pending
: it will become false
only after all pending effect calls becomes settled. launch({target: unit, params})
overload for launch
- low level method for running computation in units (events, effects or stores). Mostly used by library developers for fine-grained control of computations. effector/fork
and effector-react/ssr
: api for server side rendering and managing independent instances of application in general. This solution requires effector/babel-plugin
in babel configuration:
Example application with express Serverless example
createApi
, stores created with restore
and events created with .prepend
to domain of given source units combine
batching in a few edge cases with nested combine
calls domain.createStore
as alias for domain.store
(proposal)domain.createEvent
as alias for domain.event
domain.createEffect
as alias for domain.effect
domain.createDomain
as alias for domain.domain
sample
typings for typescript (PR #248, fix #247) (thanks @bloadvenro) forward
createStoreObject
to combine
to reduce api surface. Wherever createStoreObject
was used, it can be replaced with combine
combine
effect.done
and effect.fail
are called before effect.finally
watchers, thereby preventing side-effects from interrupting pure computations sample({clock: undefined})
forward
typings for typescript (PR #229, fix #174) (thanks @bloadvenro)clearNode(domain)
, introduced in effector 20.2.0 guard
: conditional event routing Control one event with the help of another: when the condition and the data are in different places, then we can use guard with stores as a filters to trigger events when condition state is true, thereby modulate signals without mixing them See ui visualization
Also, guard
can accept common function predicate as a filter, to drop events before forwarding them to target
Type inference Implementation tests
name
property in sample
parameters list Each basic entity in effector (event/effect/store/domain) may have a name. You now can name sampled entities in the same manner as basic ones.
split
method (PR)clearNode
been called on store belonged to certain domain led to the removal of the entire domain shortName
to domains history
to domains with read-only sets of events, effects, stores and subdomains clearNode
.sid
- stable hash identifier for events, effects, stores and domains, preserved between environments, to handle client-server interaction within the same codebase. The key is that sid can be autogenerated by effector/babel-plugin
with default config and it will be stable between builds
See example project
createEffect
for typescript #106 cannot read property .toString of undefined
error during store initialization event.filter({fn})
got a predicate function as a callback PR is
methods PR effector/compat
sample
effector/babel-plugin
to work in browser effector/compat
module to use with Smart TV (Chrome 47) apps without babel (fix #152). Starting with this release, the library code is tested by browserstack.com for compatibility with our targets, including smart tvsample
(thanks @abliarsar) (PR #156)merge
for merging events split
for pattern-matching over events clearNode
to automatically dispose all related intermediate steps Fix promise warning for effects
Add effect.finally
event.filterMap
as new alias for event.filter(fn)
extract
, withProps
, is.*
re-exports event.filter
with common predicate functions To indicate the stability of the project, we adopting semantic versioning and happy to announce version 19.0.0 for all packages. And to make the transition easier, that release contains no breaking changes; simple replacement of “^0.18.*“ to “^19.0.0” is safe for sure ☄️
store.updates
, representing updates of given store. Use case: watchers, which will not trigger immediately after creation (unlike store.watch
)clearNode
to erase information from the node itself, in addition to the existing opportunity to erase subscribers (thanks @artalar)store.reset
Add support for createEvent
and createEffect
with config (see next code example)
Add .pending
property for effects
it’s a shorthand for common use case
sample
. Sample allows to integrate rapidly changed values with common ui states Plugins are available out from a box
.babelrc
:
Use the new kernel. Provide improved eventual consistency: any side effects will be triggered only after performing all pure computations
Add is
namespace for all type validators
Add clearNode
to break references and subscriptions between events, stores, etc
Add support for custom datatypes by making step
constructors, createNode
and launch
functions public
fromObservable
, ensure it works with redux
as a typical library with Symbol.observable
support version
, now it always equals version in package.json Add effect handler to domain 4c6ae8
Add Unit<T>
as common interface implemented by Event
, Effect
and Store
Add isStore
, isEvent
, isEffect
and isUnit
validators
createStore
with config Fix webpack usage issue. To prevent this in a future, webpack integration test was added.
Improve typescript typings for createApi
. This code example became type checked
forward
: common function for forwarding updates and events store.on
{handler: Function}
as second argument to createEffect
effect.use
return the same effect instead of void (ability to chain method calls) store.defaultState
propertycreateComponent
withProps
static functioncreateWrappedDomain
to watch all nested events and updatesextract
to watch only part of nested storages.epic
method (library supports symbol-observable, so assumed that most.from(event)
or Observable.Of(store)
covered all use cases) effect.use.getCurrent()
method to get current used functioncreateStoreObject
createStore
method.get()
, .set(x)
and .map(fn)
methods)from(effect)
mill
to collect
joint
to combine
.use
effectImplementationCheck
to unused
rootDomain
alias for createRootDomain
typeConstant
eventsDomainAuto
, EventAuto
and EffectAuto
mill
fluent “AND” reducer combinator First stable version
Proof of concept
useUnit([fx])
with effect with custom error (PR #1070) Gate.open
and Gate.close
EventCallable
to allow users to call it in tests useStore
appeared in useList
(PR #1022) effector-react/scope
in favor of isomorphic hooks (PR #979)useStore
, useEvent
, connect
and createStoreConsumer
in favor of universal useUnit
(PR #951)createComponent
in favor of @effector/reflect
effector-react/ssr
module (PR #844)createWatch
implementation to improve @effector/next
updates flow useUnit
updates useUnit
during event change (issue #900, PR #901) <Gate />
will also be isomorphic by scope. @@unitShape
protocol (PR #803) in useUnit
useEvent
, useStore
, useStoreMap
and useList
isomorphic, now they would use scope
from the Provider
if it is available and scope-less mode otherwise. For useUnit
it was done in 22.2.0.forceScope
to useEvent
, useStore
, useStoreMap
and useList
to force usage of scope from Provider
, it would throw an error if Provider
is not available, /scope
module sets forceScope
to true
by default useUnit
isomorphic, now it would use scope
from the Provider
if it is available and scope-less mode otherwise (PR #776 and PR #785)forceScope
to useUnit
to force usage of scope from Provider
, it would throw an error if Provider
is not available (PR #776 and PR #785), /scope
module sets forceScope
to true
by defaultuseUnit
(PR #747) useUnit
method to read multiple stores and bind events or effects to scope in a single batched call (PR #733, #738) placeholder
option to useList
to render in cases of empty list defaultValue
option to useStoreMap
to return in cases when fn
returns undefined Gate.status
store being serialized (PR #683) Can't perform a React state update on an unmounted component
warning for useStoreMap
in a few cases (issue #574) effector-react/scope
and make effector-react/ssr
an alias for itCannot update a component
warning in useGate
undefined
in useStoreMap
domain
field in createGate
optionalcreateContextComponent
and createReactState
useStoreMap
with scope (PR #474) updateFilter
to useStoreMap
. It helps to control component rerendering, e.g. when component should rerender only when id
field is changeduseStoreMap($store, value => result)
shorthandgetKey
to useList
. Function in this field will be used to compute key for every item of listuseStore
(PR #431)createGate
to gate.displayName
and gate units (issue #449)useEvent
when used effect throw an error createGate
implementation to effector-react/ssr
useEvent
. It’s a shorthand for calling several useEvent
at once (PR #425 by @sergeysova) Gate.isOpen
plain property, which was incompatibile with concurrent mode and ssr, use Gate.status
instead useGate
with fork
support from effector-react/ssr
domain
optional field to createGate
which will be used to create gate units (useful for ssr) createGate({domain}) in documentation
useList
hook typings for typescript exported from effector-react/ssr
by allowing usage as components’ return value (fix DefinitelyTyped issue) Gate
state in createGate
via defaultState
field createGate({defaultState}) in documentation
object
restriction from createGate
Props
type in typescript, as it becomes useless with introduction of useGate
. This code now passes type checking successfully effector-react/compat
and effector-vue/compat
compatibility with IE11 useList
hook typings for typescript by allowing usage as components’ return value (fix DefinitelyTyped issue) This code now works without type errors:
useGate
, thereby making it consistent with <Gate />
createContextComponent
and createReactState
, which previously were based on createComponent
ReadonlyArray
to useList
for typescript Cdn with umd build of effector-react Cdn with umd build of effector-vue
effector/fork
and effector-react/ssr
: api for server side rendering and managing independent instances of application in general. This solution requires effector/babel-plugin
in babel configuration:
Example application with express Serverless example
createApi
, stores created with restore
and events created with .prepend
to domain of given source units fn
argument types without as const
in useStoreMap
. In effector-react 20.0.3 we introduced an improvement for useStoreMap
types, which helps to infer types of fn
arguments from keys
. And now useStoreMap
types improved even more: every item in second argument will have its own type even without as const
, out from a box PR #274 (thanks @abliarsar)
Gate.open
& Gate.close
events keys
field in useList
. By default, useList
rerenders only when some of its items was changed. Howewer, sometimes we need to update items when some external value (e.g. props field or state of another store) is changed. In such cases we need to tell react about our dependencies and pass keys explicitly. createComponent
effector-react/compat
and effector-vue/compat
effector-react/compat
module to use with Smart TV (Chrome 47) apps without babel useList
for efficient rendering of store lists useStore
with lack of store updates triggered by react hooks in children components as const
typescript assertion for useStoreMap
keys. It helps us to infer type for fn
arguments In typescript versions below 3.4, you can still use an explicit type assertion
as const in typescript docs
useStore
argument change useStoreMap
useStoreMap
hook to select part from a store. Motivation To indicate the stability of the project, we adopting semantic versioning and happy to announce version 19.0.0 for all packages. And to make the transition easier, that release contains no breaking changes; simple replacement of “^0.18.*“ to “^19.0.0” is safe for sure ☄️
createComponent
createStoreObject
in createComponent
mounted
and unmounted
events to components created by createComponent
useLayoutEffect
with useIsomorphicLayoutEffect
to support server-side rendering useEffect
with useLayoutEffect
in useStore
hook to response to state changes immediately Big thanks to egoson for making this release possible
useStoreMap
hook for Vue 3 composition API to select part from a store ((PR #780)[https://github.com/effector/effector/pull/780]) by @ilajosmanov useStore
useVModel
useGate
createGate
see docs Migrated from Vue.util.defineReactive to Vue.observable
Effector stores will show in Vue devtools
Cosmetic improvements for support plugin in the future.
Now we can add some units to effector object (will be return Store<number>)
effector-react/compat
and effector-vue/compat
compatibility with IE11 Vue.extend
(PR #343) Cdn with umd build of effector-react Cdn with umd build of effector-vue
createComponent
HOC for TypeScript usage. This HOC provides type-safe properties in vue components. effector-react/compat
and effector-vue/compat
effector-vue/compat
module to use with Smart TV (Chrome 47) apps without babel Vue adapter for effector 20
To indicate the stability of the project, we adopting semantic versioning and happy to announce version 19.0.0 for all packages. And to make the transition easier, that release contains no breaking changes; simple replacement of “^0.18.*“ to “^19.0.0” is safe for sure ☄️