Open IamCarbonMan opened 1 year ago
https://github.com/IamCarbonMan/pokegotchi
code is here. a bit messy and written in coffeescript but as far as I can tell everything meets the docs
I cannot read coffeescript, but I guess this would be the same issue I run into when using subscriptions.
I cannot see anything in the documentation related to the return value of subscription unsubscribe handler, but based on the source code the only meaningful return values are undefined
or false
see line 59 in https://github.com/jorgebucaran/hyperapp/blob/c3717e3ff78b6fa8663575d34d330d68929a0974/index.js#L48-L59
in may case my issue was caused by using one-liner. this is failing
...
return () => function_returning_something()
}
while this works perfectly fine
...
return () => {
function_returning_something()
}
}
I am curious if changing the line 59 like this would be the fix?
: (oldSub && oldSub[2](), false)
If you'd like, feel free to send over a patch along with a test script. If you need a hand with writing the test, just let me know and I'll be happy to help you out or show you how to get started. I hope that makes sense.
when stopping a subscription- by &&ing it with a falsy state value in app()- and then restarting it, I get an error "oldSub[2] is not a function". It looks like it's trying to call the 3rd element of the subscription array but according to the docs a subscription array only has 2 elements