xaviergonz / mobx-keystone

A MobX powered state management solution based on data trees with first class support for Typescript, support for snapshots, patches and much more
https://mobx-keystone.js.org
MIT License
551 stars 25 forks source link

Async Actions Questions #164

Open mikecann opened 4 years ago

mikecann commented 4 years ago

Hi,

Really impressive work with this lib mate, I have been an MST fan for quite some time but have been frustrated by its shortcomings so this lib is really refreshing to see. The docs are incredible too, great to see you have put so much effort in there.

I think there is just one spot in the API that makes me cringe a little which is the async actions, it just seems a little more messy than the rest of the API and I personally find generators ughh.

I have seen that others (https://github.com/xaviergonz/mobx-keystone/issues/148 and https://github.com/xaviergonz/mobx-keystone/issues/140) have also raised issues about async actions but I have a couple of other questions.

  1. Is it possible to use runInAction with keystone and combine it with just normal promises?

  2. I created a lib mst-flow-pipe for MST which cleans async "flow" generators up a little. Would something like this be preferable in keystone?

Thanks again for your awesome work!

gustavohenke commented 4 years ago

Couldn't agree more -- I just received mobx-keystone on my GitHub Explore daily email just yesterday, and found it to have much better API than MST.

I'd be okay with runInAction itself since at work I use mobx without any additional libs so that's the way to go.

But your lib mst-flow-pipe is a very nice evolution already! 🤩