State and context are on the public instance
Dan committed
Jun 12, 2019 at 16:50 UTC
3137553f6d843e1902029985c16ca3002831a85e
1 file changed
+16
-6
src/backend/legacy/renderer.js
+16
-6
@@ -560,8 +560,12 @@ export function attach(
560
}
561
}
562
}
563
- context = internalInstance.context || null;
564
- state = internalInstance.state || null;
563
+
564
+ const publicInstance = internalInstance._instance;
565
+ if (publicInstance != null) {
566
+ context = publicInstance.context || null;
567
+ state = publicInstance.state || null;
568
+ }
569
}
570
571
return {
@@ -696,16 +700,22 @@ export function attach(
700
function setInState(id: number, path: Array<string | number>, value: any) {
701
const internalInstance = idToInternalInstanceMap.get(id);
702
if (internalInstance != null) {
699
- setIn(internalInstance.state, path, value);
700
- internalInstance.forceUpdate();
703
+ const publicInstance = internalInstance._instance;
704
+ if (publicInstance != null) {
705
+ setIn(publicInstance.state, path, value);
706
+ forceUpdate(publicInstance);
707
+ }
708
}
709
}
710
711
function setInContext(id: number, path: Array<string | number>, value: any) {
712
const internalInstance = idToInternalInstanceMap.get(id);
713
if (internalInstance != null) {
707
- setIn(internalInstance.context, path, value);
708
- forceUpdate(internalInstance);
714
+ const publicInstance = internalInstance._instance;
715
+ if (publicInstance != null) {
716
+ setIn(publicInstance.context, path, value);
717
+ forceUpdate(publicInstance);
718
+ }
719
}
720
}
721