-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
怎样结束一个stream? #21
Comments
content内容是 |
content是Connect,有没有什么方法能检测是否已经解绑stream? 或是检测数据请求是不是返回成了sink? |
只需要把connect的函数写纯就好了,比如你connect上去的函数有没有自己创建一个stream自己消费,没有return出去的这种情况 |
您说的情况应该不会发生 我只是按照您的例子写的model并没有单独创建一个stream,我测试了没有放在modal的页面,每次都只是发生一次请求,就是这个放在modal里的 会越来越多,这个没有什么调试工具吗? |
可以试试
另外你用的哪个版本的react-most,最好升到最新,因为有一个版本用的most是有unsubscribe的bug的 |
好的 我试试看 谢谢 |
问题背景:
有一个modal框,内容为react-most组件content,modal show的时候加载content,modal hide的时候解绑content,modal本身不会解绑只是display: none,而content都是重新加载,content加载的时候会发送一条请求获取数据。
出现问题:
如果页面不刷新,每次关闭modal再打开时,content发送的请求数都会比上一次多1次,如:第一次打开时获取数据的请求发送1次,不刷新页面关闭modal再打开,获取数据请求发送2次,再关闭再打开,获取数据请求发送3次,以此类推。
我觉得可能是因为每次加载content的时候都是重新加载,因此就会创建一条stream,而关闭modal的时候只是解绑modal里的content而stream还存在,所以再加载一个新的content的时候就有两条stream存在了,所以发送了2次请求,不知道欧阳老师有什么看法?请指教
The text was updated successfully, but these errors were encountered: