Hello, we have a use case where we have multiple DeckGL react components within the same page. This appears to have worked fine as of 7.1.4. However, it no longer appears to work - the layers are stuck in an "Awaiting State" state (with state null like #2131). It appears that after the "first" DeckGL component, the other ones do not initialize their gl context (or a similar step is missing) which I think is causing the hanging state.
Create an application with two DeckGL components and add an onWebGLInitialized callback that logs out the context. There is only one.
import React, {PureComponent} from 'react';
import DeckGL from '@deck.gl/react';
import { OrthographicView } from 'deck.gl';
export default class App extends PureComponent {
_onWebGLInitialized(gl) {
console.log(gl)
}
render() {
return (
<div>
<DeckGL onWebGLInitialized={this._onWebGLInitialized} controller={true} views={new OrthographicView({id:'ortho1', controller:true, height:1024, width: 1024})}>
</DeckGL>
<DeckGL onWebGLInitialized={this._onWebGLInitialized} controller={true} views={new OrthographicView({id:'ortho2', controller:true, height:1024, width: 1024})}>
</DeckGL>
</div>
);
}
}
Note there is only 1 log statement - in the last build of our application there are three for 3 separate components
deck: deck.gl 8.0.9 - set deck.log.level=1 (or higher) to trace attribute updates init.js:45
WebGL2RenderingContext { _version: 2, luma: {…}, getQueryObject: getQueryObject(), readBuffer: readBuffer(), getVertexAttrib: getVertexAttrib(), getProgramParameter: getProgramParameter(), getInternalformatParameter: getInternalformatParameter(), getTexParameter: getTexParameter(), getParameter: get(), hint: set(), … }
@tsherif It seems that AnimationLoop fails to initiate more than one instances, due to
https://github.com/uber/luma.gl/blob/1310e16211a7346ad969efb8b69d3e27a6d53899/modules/engine/src/lib/animation-loop.js#L298-L300
Instead of window.onload it needs to use window.addEventListener so that multiple listeners can be attached.
Fixed in 8.0.10.
Most helpful comment
Fixed in 8.0.10.