Alt data dependency between actions not stores

穿精又带淫゛_ 提交于 2019-12-13 05:19:41

问题


I have a react app where I'm using alt for the flux architecture side of things.

I have a situation where I have two stores which are fed by ajax calls in their corresponding actions.

Having read the alt getting started page on data dependencies it mentions dependencies between stores using waitFor - http://alt.js.org/guide/wait-for/ but I don't see a way to use this kind of approach if one of my store actions is dependent on another store action (both of which are async).

If I was doing this inside a single action handler, I might return or chain some promises but I'm not sure how to implement this across action handlers. Has anyone achieved this? or am I going about my usage of ajax in react the wrong way?

EDIT: More detail.

In my example I have a list of nodes defined in a local json config file, my node-store makes an ajax request to get the node detail. Once it's complete, a different component (with a different action handler and store) wants to use the node collection to make an ajax query to different endpoints a node may expose.

The nodes are re-used across many different components so I don't want to roll their functionality into several different stores/action handlers if possible.

来源:https://stackoverflow.com/questions/33253441/alt-data-dependency-between-actions-not-stores

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!