Flux Dispatch.dispatch(…): Cannot dispatch in the middle of a dispatch
2018-03-03 10:22
513 查看
在使用flux进行数据交互的时候,出现了一个问题
解决方案:
老外是这么说的:
You can make it work by “scheduling” the next action instead of calling it directly, here is an example code:
译:你可以在指定的时间调度一个action而不是直接调用它。
我的解决方案:
这样就可以了,真心感觉老外很热心。
Flux Dispatch.dispatch(…): Cannot dispatch in the middle of a dispatch,在国内竟然没有找到解决方案,最后在https://stackoverflow.com上找到了解决方案,但是原理不清楚【这不是我的风格,空下来一定搞懂】。
解决方案:
老外是这么说的:
You can make it work by “scheduling” the next action instead of calling it directly, here is an example code:
译:你可以在指定的时间调度一个action而不是直接调用它。
// instead of doing this Dispatcher.dispatch(...); // go like this setTimeout(function() { Dispatcher.dispatch(...); }, 1);
我的解决方案:
setTimeout(function () { Actions.synchronizePanekeyToStore(currenPaneKey); }, 1);
这样就可以了,真心感觉老外很热心。
相关文章推荐
- Android studio: The number of method references in a .dex file cannot exceed 64K. Learn how to resol
- Cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additio
- “System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 错误
- 关于Cannot assign to 'self' outside of a method in the init family解决方法
- git pull error:You are in the middle of a conflicted merge
- LintCode Delete Node in the Middle of Singly Linked List 在O(1)时间复杂度删除链表节点
- 方法数超过64K:The number of method references in a .dex file cannot exceed 64K.
- 【原】Cannot find entry file index.ios.js [index.android.js] in any of the roots
- 关于error:Cannot assign to 'self' outside of a method in the init family
- The number of method references in a .dex file cannot exceed 64K.
- The number of method references in a .dex file cannot exceed 64k API 17
- 关于error:Cannot assign to 'self' outside of a method in the init family
- Android SDK低版本切换高版本错误 Error:The number of method references in a .dex file cannot exceed 64K.
- React Native demo运行报错:Cannot find entry file index.android.js in any of the roots
- 关于error:Cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- ADODB使用excel的"Cannot modify the design of table 'xxxx'. It is in a read-only database"的问题
- 372. 在O(1)时间复杂度删除链表节点 (delete-node-in-the-middle-of-singly-linked-list)(c++)----lintcode面试题之链表