From 3137553f6d843e1902029985c16ca3002831a85e Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 12 Jun 2019 16:50:15 +0100 Subject: [PATCH] State and context are on the public instance --- src/backend/legacy/renderer.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/backend/legacy/renderer.js b/src/backend/legacy/renderer.js index 517d903e33..2ab7f56552 100644 --- a/src/backend/legacy/renderer.js +++ b/src/backend/legacy/renderer.js @@ -560,8 +560,12 @@ export function attach( } } } - context = internalInstance.context || null; - state = internalInstance.state || null; + + const publicInstance = internalInstance._instance; + if (publicInstance != null) { + context = publicInstance.context || null; + state = publicInstance.state || null; + } } return { @@ -696,16 +700,22 @@ export function attach( function setInState(id: number, path: Array, value: any) { const internalInstance = idToInternalInstanceMap.get(id); if (internalInstance != null) { - setIn(internalInstance.state, path, value); - internalInstance.forceUpdate(); + const publicInstance = internalInstance._instance; + if (publicInstance != null) { + setIn(publicInstance.state, path, value); + forceUpdate(publicInstance); + } } } function setInContext(id: number, path: Array, value: any) { const internalInstance = idToInternalInstanceMap.get(id); if (internalInstance != null) { - setIn(internalInstance.context, path, value); - forceUpdate(internalInstance); + const publicInstance = internalInstance._instance; + if (publicInstance != null) { + setIn(publicInstance.context, path, value); + forceUpdate(publicInstance); + } } }