The trigger supports `throttle`, `debounce` and `takeLeading` now
Breaking change
Removed actionTypeDelimiter
from App constructor, this will enforce to use /
as action type delimiter
New feature
The effects()
trigger map now support throttle
, debounce
and takeLeading
takeLeading
example of only do fetching user once in one time
const [effects] = model.effects({}, {
requestUser: {
*takeLeading() {
yield call(API.getUser)
}
}
})
debounce
example of decreasing the rate of validation function call when input changes
const [effects] = model.effects({}, {
handleInputChange: {
*debounce(input) {
yield call(validate, input)
},
ms: 500,
}
})
throttle
example of limiting the API calls of requesting suggestions on input changes
const [effects] = model.effects({}, {
requestSuggestions: {
*throttle(input) {
yield call(API.findSuggestions, input)
},
ms: 1000,
}
})