onSelectedEntityChange is causing an onTick renderError

1. A concise explanation of the problem you’re experiencing.

I’m trying to set the colour of polylines drawn in a data source based on the most recent geojson data source polygon that was clicked. It works, and intermittently produces the error listed at the bottom.

I tried setting the showRenderLoopErrors to false, hoping that I could get console logs, but I could not dig deeper.

I tried adding an event listener to cesiumViewer.scene.renderError in order to print the scene and the error, but it never seems to raise.

The actual error happens on tick, so I think it may be linked to billboards I have the are circles that move along the polylines from one country to another. Their colour property is a ReferenceProperty to the colour of the polyline which they are moving along.

I’m at a loss for how to diagnose this issue. Removing the setValue line, stops the colours from changing and the error.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

this.cesiumViewer.selectedEntityChanged.addEventListener(function(selectedEntity){

if ( selectedEntity && selectedEntity.properties ) {

const entityType = selectedEntity.properties.entityType.getValue();

switch( entityType ){

case ‘locality’:

const selected_locality = selectedEntity.properties.locality.getValue();

cesiumMapComponent.arcsDataSource.entities.values.forEach( entity => {

if( entity

&& entity.polyline

&& entity.polyline.material

&& entity.polyline.material.color ){

const color = cesiumMapComponent.selectConversationColor( entity.properties.arcId.getValue() , cesiumMapComponent )

console.log( ‘setting this color’, color, ‘replacing this color’, entity.polyline.material.color.getValue() )

/* example output. The colour is always set and defaults to slate grey ( the second colour in the printout )

setting this color Color {red: 0.6039215686274509, green: 0.803921568627451, blue: 0.19607843137254902, alpha: 1} replacing this color Color {red: 0.4392156862745098, green: 0.5019607843137255, blue: 0.5647058823529412, alpha: 1}

*/

entity.polyline.material.color.setValue( color );

}

});

break;

}

}

});

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

Visual context of flow from one country, region, city to another.

4. The Cesium version you’re using, your operating system and browser.

Cesium 1.44

Mac OS 10.13.1

Version 66.0.3359.139 (Official Build) (64-bit)

  1. The full error I’m getting:

An error occurred while rendering. Rendering has stopped.

TypeError: Cannot read property ‘update’ of undefined
TypeError: Cannot read property ‘update’ of undefined
at StaticGeometryPerMaterialBatch.update (http://10.1.0.7:3000/static/js/bundle.js:107486:34)
at PolylineVisualizer.update (http://10.1.0.7:3000/static/js/bundle.js:102849:36)
at DataSourceDisplay.update (http://10.1.0.7:3000/static/js/bundle.js:87274:41)
at Viewer._onTick (http://10.1.0.7:3000/static/js/bundle.js:262137:49)
at Event.raiseEvent (http://10.1.0.7:3000/static/js/bundle.js:27969:30)
at Clock.tick (http://10.1.0.7:3000/static/js/bundle.js:15365:21)
at CesiumWidget.render (http://10.1.0.7:3000/static/js/bundle.js:255355:43)
at render (http://10.1.0.7:3000/static/js/bundle.js:254729:32)

Hi Wayne,

Do you have the rest of your code? Normally what I’d do in the situation is try to debug by using the browser’s developer tools and putting breakpoints at points in the stack trace.

I believe it’s the polylines, not the billboards because the error is arising in PolylineVisualizer.

Thanks,

Gabby

Sorry for the long delay. It had something to do with the colours. I just removed the code to change the colour of the lines and moved on.