foxdonut/meiosis

How to turn off a "map" callback?

Closed this issue · 5 comments

I might use map on a stream down in a component that later gets unmounted. How do I stop the callback from continuing to happen?

I may be thinking about it wrong. If so, please correct me. I'm just getting started with this sort of state management.

hi @gbishop

which stream library are you using?

I was using meiosis-setup simple-stream (as I vaguely recall). I should have posted the question there.

I solved my problem by making my function conditional on the element being connected and later moved to my own code using the meiosis idea.

@gbishop posting here is fine! Glad it worked out.

For anyone referencing this issue, there isn't a way yet on simple-stream to end the map callback, solution would be to switch to flyd or mithril-stream and use end.

The end stream function will be available in meiosis-setup's simple-stream in the next release (5.2.0). Prior to release you will find it available in version 5.2.0-beta.2.