Closed vladyn closed 4 years ago
I suspect you are using hyperapp v2, whereas this logger (judging by the signature) is for hyperapp v1.
I suspect you are using hyperapp v2, whereas this logger (judging by the signature) is for hyperapp v1.
Oh my, you're absolutely right! Good catch! Did you had any previous experience with similar tool for logging the state and actions in HP2?
THere is: https://github.com/mrozbarry/hyperapp-debug It may still be under development though. Haven't checked it recently. Perhaps @okwolf is planning a v2 version of the logger?
Personally I usually just hook in to the middleware. Unfortunately there aren't docs for it yet, but basically:
app({
...
middleware: originalDispatch => (action, data) => {
if (typeof action !== 'function' && (
!Array.isArray(action) ||
!Array.isArray(action[0])
) console.log('New state', action)
return originalDispatch(action, data)
}
})
...or something like that. Just typed it off the top of my head and didn't test it
Personally, I usually just hook in to the middleware. Unfortunately, there aren't docs for it yet, but basically:
... a perfect shot from the top of your head - works like a charm! I've added some console.group along with console.dir for good looking - thank you!
I hadn't been planning an update to the logger, but I might consider it.
Hello there, I'm constantly getting the above Error passing any of the view of my app. I'm invoking the logger from a class constructor:
withLogger(app)(state, actions, this.views.intro(state), document.body);
And yes, this come from the hyperapp in the render function, but indeed the node of the view is undefined. Anybody having an idea what I'm doing wrong?