I am unable to see the geojson layer when I switch between map view and scene view after I apply edits to a GeoJSONLayer. I am seeing the following errors, and the layer doesn't get rendered:
react_devtools_backend.js:2540 [esri.views.3d.layers.GeoJSONLayerView3D] #resolve() Failed to resolve layer view (layer title: 'GeoJSON', id: '17d25b1be7e-layer-4') TypeError: s.equals is not a function
at s (projectExtentUtils.js:5)
at FeatureLikeLayerView3D.js:5
react_devtools_backend.js:2540 [esri.views.LayerViewManager] Failed to create layerview for layer title:'GeoJSON', id:'17d25b1be7e-layer-4' of type 'geojson'
The errors happen after I apply edits to an existing GeoJSONLayer. I think I have found the problem: when ApplyEdits() is called, certain properties belonging to the feature are changed, even though I didn't change them. The below pic shows a comparison of the same feature before (right) and after (left) applyEdits is called. You can see the fullExtent property has changed, which is referenced in the code throwing the error.
---------------------
SOLUTION: So after applyEdits the fullExtent property of the modified layer gets changed, which causes an error upon toggling mapView/sceneView. The solution is to store the original fullExtent and reassign it to the layer after its features have been updated. This seems like a bug since I don't see it documented anywhere.
---------------------

Here is the code where I call applyEdits() on a geojsonlayer
private handleHighlightEvent(layer: GeoJSONLayer): void {
const query = layer.createQuery();
query.where = "featureId = '" + this.id + "'"; // select the feature by attribute
layer.queryFeatures(query).then((results) => {
const features = results.features;
this.updateFeatures(features, layer);
});
}
private updateFeatures(results, layer: GeoJSONLayer)
{
if (results.length > 0)
{
const updatedGraphics = {
updateFeatures: []
}
results.forEach((feature) => {
const isStyleChanged: boolean = feature.attributes[UNIQUE_VALUE_RENDERER_FIELD] != this.style;
feature.attributes[UNIQUE_VALUE_RENDERER_FIELD] = this.style; // apply an alternate style to feature
if (isStyleChanged) // if style changed update graphic
{
updatedGraphics.updateFeatures.push(feature); // update feature
}
})
if (updatedGraphics.updateFeatures.length > 0){
this.applyEditsToGeoJSON(updatedGraphics, layer); // causes error when toggling
}
}
}
private applyEditsToGeoJSON(params, layer: GeoJSONLayer)
{
layer.applyEdits(params);
}