Published by igorkamyshev about 2 years ago
Provider
from main modulePublished by igorkamyshev about 2 years ago
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 all hooks 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)Published by igorkamyshev about 2 years ago
useUnit
isomorphic, now it would use scope
from the Provider
if it is available and scope-less mode otherwise (PR #782)forceScope
to useUnit
to force usage of scope from Provider
, it would throw an error if Provider
is not available (PR #782), /scope
module sets forceScope
to true
by defaultPublished by zerobias about 2 years ago
Published by zerobias about 2 years ago
Published by zerobias about 2 years ago
Published by zerobias about 2 years ago
Published by zerobias about 2 years ago
Published by sergeysova about 2 years ago
Full Changelog: https://github.com/effector/effector/compare/[email protected]@22.1.1
Published by sergeysova over 2 years ago
useUnit
method to read multiple stores and bind events or effects to scope in a single batched call (PR #733, #738)import {createEvent, createStore, fork} from 'effector'
import {useUnit, Provider} from 'effector-react/scope'
const inc = createEvent()
const $count = createStore(0)
const $title = createStore('useStore example')
$count.on(inc, x => x + 1)
const App = () => {
const [count, title, incFn] = useUnit([$count, $title, inc])
return (
<>
<h1>{title}</h1>
<p>Count: {count}</p>
<button onClick={() => incFn()}>increment</button>
</>
)
}
const scope = fork()
render(
() => (
<Provider value={scope}>
<App />
</Provider>
),
document.getElementById('root'),
)
placeholder
option to useList
to render in cases of empty listconst ChatList = () => (
<div>
{useList($chats, {
fn: (chat) => <div>Chat {chat.name}</div>,
keys: [],
placeholder: <div>You have no chats yet. Add first one?</div>
})}
</div>
)
defaultValue
option to useStoreMap
to return in cases when fn
returns undefinedconst ChatName = ({id}) => {
const chat = useStoreMap({
store: $chats,
keys: [id],
fn: (chats) => chats.find((chat) => chat.id === id),
defaultValue: {id: 'default', name: 'Default chat'},
})
return <span>{chat.name}</span>
}
Gate.status
store being serialized (PR #683)Full Changelog: https://github.com/effector/effector/compare/[email protected]@22.1.0
Published by sergeysova over 2 years ago
createWatch
https://github.com/effector/effector/pull/646
Full Changelog: https://github.com/effector/effector/compare/[email protected]@22.3.0
Published by sergeysova over 2 years ago
Fixed bug with wrong behaviour of classList
with static object values #649
Published by sergeysova over 2 years ago
Added support for classList
in h()
and spec()
#638
CSS classes can be merged and applied via multiple spec()
calls:
h('div', {
attr: { class: "basic" },
classList: ["another"],
fn() {
spec({ classList: { first: true, second: false } })
spec({ classList: ['second', 'third'] })
},
})
Result will be:
<div class="basic another first second third"></div>
Published by zerobias over 2 years ago
filter
option to sample
, thereby making guard
an alias (issue #521)sample({
clock: submitPasswordEvent,
source: $store,
filter: (state: AuthFlowState) => state is WaitingPasswordState,
fn: (waitingPasswordState, clock) => waitingPasswordState.password,
target: submitPassowrdFx,
})
clock
option to split
(issue #537)split({
clock: submit,
source: $form,
match: $mode,
cases: {
draft: saveFormDraftFx,
send: sendFormToBackendFx,
}
})
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)Published by zerobias almost 3 years ago
Published by zerobias almost 3 years ago
Can't perform a React state update on an unmounted component
warning for useStoreMap
in a few cases (issue #574)Published by sergeysova about 3 years ago
effector/babel-plugin
in patronum/macro
https://github.com/effector/effector/commit/68dffae660eea209de17e6d88b72edb7c82b87de
Published by zerobias about 3 years ago
.on
and .reset
methodsPublished by sergeysova about 3 years ago
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.
Published by zerobias about 3 years ago
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
effector-react/scope
and make effector-react/ssr
an alias for itCannot update a component warning
in useGate
useStoreMap
domain
field in createGate
optionalcreateContextComponent
and createReactState