sample({
clock: clickValidate,
source: $formFields,
target: [validateForm, sendStatsFx],
})
- Add support for case functions, case stores and matcher stores to
split
. Case functions and stores will choose target case by its name, matcher stores are boolean stores which indicate whether to choose given case
const source = createEvent()
const even = createEvent()
const odd = createStore(0)
split({
source,
// matcher function
match(n) {
if (n % 2 === 0) return 'even'
return 'odd'
},
cases: {
even,
odd,
}
})
const $currentPage = createStore('dashboard')
split({
source,
// matcher store
match: $currentPage,
cases: {
dashboard: even,
__: odd,
}
})
const tryUpdatePage = createEvent()
const updatePageFx = createEffect()
const $hasWriteAccess = createStore(false)
split({
source: tryUpdatePage,
match: {
// case store
admin: $hasWriteAccess
},
cases: {
admin: updatePageFx,
}
})
- Add
updateFilter
config field tocreateStore
to skip arbitrary store updates (discussion #428)
const $playerPosition = createStore({x: 0, y: 0}, {
updateFilter: (update, current) => update.x !== current.x
})
- Add support for
sample
withclock
withoutsource
. For example, it useful in cases whenclock
is array of units and nosource
stores is needed
sample({
clock: [fx1.doneData, fx2.doneData],
fn: data => ({url: '/stats', data})
target: fetchFx,
})
- Add support for
clock
toguard
to improve developer expirience in cases when update trigger (clock
field) and data source (source
field) are different things
guard({
clock: validateForm,
source: $formFields,
filter: formFields => validator(formFields),
target: submitFormFx,
})
-
Add
addNames
field to babel plugin (PR #450) -
Add type support for
Scope
toclearNode
(issue #441) -
Add
compositeName
toDomain
typings, making it consistent with other units -
Add
EventPayload
andUnitValue
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
andguard
typings