From aaace75a156bd9cdb91c9d58a19703e0f9844f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Sun, 7 May 2017 10:03:52 +0200 Subject: [PATCH] fix(gl-react): prefer to _addGLNodeChild in DidMount NB I need to test that more deeply. this is to fix that React16 seem have different willMount/unmount ordering & the Surface#_addGLNodeChild now starts to trigger the 'one child at a time' invariant for a normal "switch", probably because newChild._addGLNodeChild is called before oldChild._removeGLNodeChild --- packages/gl-react/src/Node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gl-react/src/Node.js b/packages/gl-react/src/Node.js index 2a5bff0..ad2d38c 100755 --- a/packages/gl-react/src/Node.js +++ b/packages/gl-react/src/Node.js @@ -419,12 +419,12 @@ export default class Node extends Component { } componentWillMount() { - const { glParent, glSurface: { gl } } = this.context; + const { glSurface: { gl } } = this.context; if (gl) this._prepareGLObjects(gl); - glParent._addGLNodeChild(this); } componentDidMount() { + this.context.glParent._addGLNodeChild(this); this.redraw(); if (this.props.sync) this.flush(); }