Skip to content

Commit

Permalink
fix: make setState asynchronous
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Sep 16, 2020
1 parent 32ae448 commit 73f9d40
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/SwingSet/src/devices/plugin-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,16 @@ export function buildRootDeviceNode(tools) {
return connectedState[index];
},
setState(state) {
connectedState[index] = state;
saveState();
return new HandledPromise(resolve => {
connectedState[index] = state;
endowments.queueThunkForKernel(() => {
// TODO: This is not a synchronous call.
// We need something akin to read-write separation
// to get the benefits of both sync and async.
saveState();
resolve();
});
});
},
}),
);
Expand Down

0 comments on commit 73f9d40

Please sign in to comment.