in modules/core/src/layers/xviz-layer.js [262:289]
updateState({props, oldProps, changeFlags}) {
let {type} = this.state;
if (changeFlags.dataChanged) {
// Pre-process data
let data = props.data;
const dataType = this._getLayerType(data);
type = XVIZ_TO_LAYER_TYPE[dataType];
if (type === 'scatterplot' && data[0].vertices && Array.isArray(data[0].vertices[0])) {
// is multi point
data = data.reduce((arr, multiPoints) => {
multiPoints.vertices.forEach(pt => {
arr.push({...multiPoints, vertices: pt});
});
return arr;
}, []);
}
this.setState({data});
}
if (type !== this.state.type || props.style !== oldProps.style) {
const styleToLayerProp = STYLE_TO_LAYER_PROP[type];
const layerProps = this._getDefaultLayerProps(props.style, styleToLayerProp);
this.setState({type, layerProps});
}
}