tweak(action-bridge): Always process.nextTick inbound IPC events, see comment

This commit is contained in:
Ben Gotow 2015-09-10 18:50:14 -07:00
parent e4494990a9
commit 1e705b9fb1

View file

@ -66,6 +66,14 @@ class ActionBridge
Actions[name].listen(callback, @)
onIPCMessage: (initiatorId, name, json) =>
# There's something very strange about IPC event handlers. The ReactRemoteParent
# threw React exceptions when calling setState from an IPC callback, and the debugger
# often refuses to stop at breakpoints immediately inside IPC callbacks.
# These issues go away when you add a process.nextTick. So here's that.
# I believe this resolves issues like https://sentry.nylas.com/sentry/edgehill/group/2735/,
# which are React exceptions in a direct stack (no next ticks) from an IPC event.
process.nextTick =>
console.debug(printToConsole, "ActionBridge: #{@initiatorId} Action Bridge Received: #{name}")
args = Utils.deserializeRegisteredObjects(json)