ds300 / derivablejs

Functional Reactive State for JavaScript and TypeScript
Apache License 2.0
515 stars 23 forks source link

deriver function is never called. #67

Closed fiatjaf closed 7 years ago

fiatjaf commented 7 years ago

I'm just getting started and puzzled by this behavior that looks counterintuitive to me.

When my code reaches this point, it attempts to use a value that is derived from another value that has just been set.

However, calling .get() on the derived value yields an empty string: ''.

At the same time, none of the derive functions that should have been called are called. I've set up breakpoints there and so on. Nothing.

Is this some issue related to asynchronicity? Please help me.

ds300 commented 7 years ago

The code looks OK to me. Happy to debug for you. I tried running it but can't figure out how. Any chance you could set up a minimal project which reproduces the issue?

fiatjaf commented 7 years ago

Thank you, @ds300! Is it ok if you open it directly on my development server?

[REDACTED]

ds300 commented 7 years ago

Hmm looks like you were using the latest API with changes from @oskbor earlier this year, but I hadn't published that stuff yet because I'm stupid. Just published it to npm under version 2.0.0-beta.0. Hope that fixes your issues!

fiatjaf commented 7 years ago

Oh, that has fixed it. Thank you very much!

I was using the 1.0.0-beta.12 version along with guidelines from the README (not the docs page) because it looked like react-derivable needed this.