ApplyEdits Issues - Map Not Redrawing

1419
3
08-02-2021 05:25 AM
rogenjh
New Contributor III

Hey everyone -- has anyone seen performance issues with ApplyEdits on 4.20? 

We're getting an issue with our code in which the map is not redrawing after an apply edits function is called. We are also getting an error with an esri core worker, which may or may not be related. I can see in my console that deletedFeatures is in fact being applied, but then the map doesn't update. Interestingly, when I zoom in our out, I lose my labels on the feature reduction cluster unless I come back to the initial zoom level. Not sure if there was a breaking change I missed or if this is a known or unknown issue.

Here are some snippets of code:

 

public async getCurrentFeatures(): Promise<any> {
    const query: __esri.Query = this.currentLayer.createQuery();
    try {
      const { features } = await this.currentLayer.queryFeatures(query);
      return features;
    } catch (e) {
      this.reportError(e);
    }
  }


public async rendersAssetsMatchingSearchToMap(sites: SiteSummary[]): Promise<void> {

    if (this.currentLayer) {
      const addFeatures: __esri.Graphic[] = [];
      const regionsInSites = {};
      sites.forEach(siteSummary => {
        if (!isNaN(siteSummary.latitude) && !isNaN(siteSummary.longitude)) {
          addFeatures.push(this.makeASiteGraphic(siteSummary));
        }
      });

      const deleteFeatures = await this.getCurrentFeatures();
      const edits: __esri.FeatureLayerApplyEditsEdits = {};
      if (addFeatures?.length) {
        edits.addFeatures = addFeatures;
      }
      if (deleteFeatures?.length) {
        edits.deleteFeatures = deleteFeatures;
      }

      this.currentLayer
        .applyEdits(edits)
        .catch(e => {
          console.log(e);
        });
      }
    }

 

After I run this, I can see in the console that it is being applied. This is on a "clear" call, so there wouldn't be any addFeatures.

rogenjh_0-1627906949719.png

Map doesn't update:

rogenjh_1-1627907005837.png

 

It does lose labels when I zoom out:

rogenjh_2-1627907030975.png

Labels return when I zoom back in...(no additional searches applied)

rogenjh_3-1627907050669.png

Anyone have thoughts or ideas here? Again, this just recently started and it was all working fine before the updates.

0 Kudos
3 Replies
rogenjh
New Contributor III

And if this helps at all ... this is the error I'm seeing.

rogenjh_0-1627913726542.png

 

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

Is it possible for you to share your service with me? It would help to narrow down the issue. If not then, can you please tell me if it is enterprise of hosted feature service? If enterprise then what version of the server are you using? 

Thanks,

-Undral

0 Kudos
rogenjh
New Contributor III

Oh man ... I'm getting mixed up what you mean by service here, my apologies. I'm currently on ArcMap FeatureLayer if that helps.

For what this is worth ... I reverted to 4.19.0 and the code is now working.

0 Kudos