bcherny / undux

⚡️ Dead simple state for React. Now with Hooks support.
https://undux.org
MIT License
1.49k stars 31 forks source link

How to call a function AFTER the store has updated #111

Closed chrisbrantley closed 10 months ago

chrisbrantley commented 4 years ago

I need to call a function after observer.complete() is called. Looking at the rxjs docs it looks like you can pass a 3rd argument to .subscribe and it'll be called after the changes are committed? I'm doing this:

store.on("myKey").subscribe(null, null, () => { console.log("HERE"); });

But that function is never called. Any ideas?

Also, the docs say:

on returns a full RxJS Observable, so you have fine control over how you react to a change. Effects have access to around 100 utility functions that are included with RxJS.

However, it doesn't seem to support all of the methods of the Observable class. Is this because of rxjs-observable? Is it possible to have store.on() return an actual Observable if RxJS is available?

bcherny commented 10 months ago

PRs to rxjs-observable welcome!