Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/app/src/app/overmind/createConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ const IS_PRODUCTION = process.env.NODE_ENV === 'production';
function createReaction(overmind: any) {
return (reactionCb: any, updateCb: any) => {
const tree = overmind.proxyStateTree.getTrackStateTree();
const updateReaction = () => {
tree.trackScope(
() => reactionCb(tree.state),
() => {
updateCb(reactionCb(tree.state));
updateReaction();
}
);
};

tree.trackScope(
() => reactionCb(tree.state),
() => updateCb(reactionCb(tree.state))
);
updateReaction();

return () => {
overmind.proxyStateTree.disposeTree(tree);
Expand Down
5 changes: 3 additions & 2 deletions packages/app/src/app/overmind/effects/live/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ export default {
.receive('ok', resolve)
.receive('error', reject);
} else {
// eslint-disable-next-line prefer-promise-reject-errors
reject('Channel is not defined');
// we might try to send messages even when not on live, just
// ignore it
resolve();
}
});
},
Expand Down