The dispatch initializer ends in an endless loop on init when dispatching any action
Author: rucsiCreated Dec 17, 2021Updated Feb 8, 2023
I'm trying to use the the dispatch initializer as it is in the example with a log effect
const middleware = (dispatch) =>
(action, payload) => {
// Dispatch anonymous action which triggers logging effect.
dispatch((state) => [state, log(state)])
// Afterwards, carry on normally.
dispatch(action, payload)
}
app({
// ...
dispatch: middleware
})but it ends in an endless loop. no matter what my log effect does. even if I just do dispatch(state => state) it gets in the loop.
Source: hyperapp/hyperapp