From a7e38f2f76e1e6fa6942380e7dbdcd4e7184b2e6 Mon Sep 17 00:00:00 2001 From: Peter Chapman Date: Tue, 17 Apr 2018 10:47:03 -0400 Subject: [PATCH 1/3] componenetDidCatch --- src/view_wrapper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view_wrapper.tsx b/src/view_wrapper.tsx index 2007bb6..2b6f434 100644 --- a/src/view_wrapper.tsx +++ b/src/view_wrapper.tsx @@ -94,7 +94,7 @@ export default class ViewWrapper extends React.Component, this.execContext.destroy(); } - public unstable_handleError(e) { + public componentDidCatch(e) { // tslint:disable-next-line:no-console console.error('Failed to compile React component\n', e); this.setState({ componentError: e }); From 60a37bbb2f01e3fdfd8fc1ee4e527916b1253221 Mon Sep 17 00:00:00 2001 From: Peter Chapman Date: Tue, 17 Apr 2018 11:15:55 -0400 Subject: [PATCH 2/3] logging errors on --- src/core.ts | 4 ++-- src/runtime/exec_context.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core.ts b/src/core.ts index af9c500..3f4818c 100644 --- a/src/core.ts +++ b/src/core.ts @@ -9,7 +9,7 @@ import { create, Environment, root } from './environment'; import Message, { MessageConstructor } from './message'; import ExecContext from './runtime/exec_context'; import StateManager from './runtime/state_manager'; -import { mapResult, reduceUpdater } from './util'; +import { log, mapResult, reduceUpdater } from './util'; import ViewWrapper from './view_wrapper'; /** @@ -182,7 +182,7 @@ export const container: (def: ContainerDef) => Container = withEnvironm */ export const isolate = (ctr: Container, opts: any = {}): IsolatedContainer => { const stateManager = opts.stateManager && always(opts.stateManager) || (() => new StateManager()); - const env = create({ dispatcher: nthArg(2), effects: new Map(), log: () => {}, stateManager }); + const env = create({ dispatcher: nthArg(2), effects: new Map(), log, stateManager }); const container = assign(mapDef(ctr.identity()), { accepts: always(true) }) as Container; const parent: any = opts.relay ? { relay: always(opts.relay) } : null; diff --git a/src/runtime/exec_context.ts b/src/runtime/exec_context.ts index 93325d3..1b7be85 100644 --- a/src/runtime/exec_context.ts +++ b/src/runtime/exec_context.ts @@ -216,7 +216,7 @@ export default class ExecContext { } public dispatch(message: Message) { - return trap(this.errLog(null), this.internalDispatch.bind(this))(checkMessage(this, message)); + return trap(this.errLog(message), this.internalDispatch.bind(this))(checkMessage(this, message)); } public commands(msg, cmds) { From fa6cc1fa94a6f9db5c49b54f3a94378363c64a18 Mon Sep 17 00:00:00 2001 From: Peter Chapman Date: Tue, 17 Apr 2018 12:03:38 -0400 Subject: [PATCH 3/3] putting null back in it's place --- src/runtime/exec_context.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/exec_context.ts b/src/runtime/exec_context.ts index 1b7be85..93325d3 100644 --- a/src/runtime/exec_context.ts +++ b/src/runtime/exec_context.ts @@ -216,7 +216,7 @@ export default class ExecContext { } public dispatch(message: Message) { - return trap(this.errLog(message), this.internalDispatch.bind(this))(checkMessage(this, message)); + return trap(this.errLog(null), this.internalDispatch.bind(this))(checkMessage(this, message)); } public commands(msg, cmds) {