<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 4.29 - ApplyEdits callback BEFORE visible on the MAP ISSUE in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-29-applyedits-callback-before-visible-on-the-map/m-p/1377692#M83535</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I did not quite exactly follow the issue you are reporting here. It seems like the problem is applyEdits performance when being called frequently? If so applyEdits method is not meant to be used with such high frequency. If you are updating feature frequently then consider using StreamLayer instead.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This document talks about different ways of creating stream layer:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#creating-a-streamlayer" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#creating-a-streamlayer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2024 18:06:43 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2024-02-02T18:06:43Z</dc:date>
    <item>
      <title>4.29 - ApplyEdits callback BEFORE visible on the MAP ISSUE</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-29-applyedits-callback-before-visible-on-the-map/m-p/1377504#M83530</link>
      <description>&lt;P&gt;Hi. It seems like featureLayer.applyEdits returns a result when the data is processed by the api but not actual visible on the map.&lt;BR /&gt;&lt;BR /&gt;To reproduce this, I made a codepen with a &lt;STRONG&gt;loop creating events&lt;/STRONG&gt;/messages/graphicupdates each&lt;STRONG&gt; 10 ms - 1000 ms&lt;/STRONG&gt;. These messages will be merged into 1 BUFFER (being a subject).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Snippet&lt;/U&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;from(updates).pipe(
            concatMap(item =&amp;gt; of (item).pipe(delay(100))), // UPDATES TRIGGERED EACH 100 ms -&amp;gt; could be random between 10-300 ms
            tap(() =&amp;gt; { 
                    ... // merge logic so no updates will be lost
                    bufferSubject.next(currentBuffer); 
            })
).subscribe();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;2. A subscription of the bufferSubject (asObservable)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; bufferSubject.asObservable()
          .pipe(
            skipWhile(() =&amp;gt; dataAppliedSubject.value), //Made a dataAppliedSubject -&amp;gt; while applying this buffer, next one will be skipped
            filter((buffer) =&amp;gt; buffer.length &amp;gt; 0),
            concatMap(async (buffer) =&amp;gt; {
              dataAppliedSubject.next(true);
              return applyDataToMap(layer, buffer) // applyEdits logic async from ArcGis API
            }),
            tap((res) =&amp;gt; {
              // THIS should only be triggered when APPLYEDITS is fully processed. But it looks like its not fully rendered on the map -&amp;gt; This will be an issue
              dataAppliedSubject.next(false); // When applied -&amp;gt; ready for next buffer
            })
          )
          .subscribe();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;ISSUE:&lt;/STRONG&gt;&lt;BR /&gt;When I change the delay to 300. The updates are being displayed without any problems or lagg.&amp;nbsp;&lt;BR /&gt;When changing the delay to 10. The updates are processed way too fast and it stops working. (no changes visible on the map).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Approach:&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;Maybe the applyEdits should only return results when they are fully processed by the api AND fully DRAWN on the map?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#event-edits" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#event-edits&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;Fires after&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" target="_blank" rel="noopener"&gt;applyEdits()&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;is completed successfully." Looks like it's not 100% correct&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Is it possible to achieve this?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Codepen&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/michaelk95/pen/GRexMJR?editors=1000" target="_blank" rel="noopener"&gt;https://codepen.io/michaelk95/pen/GRexMJR?editors=1000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 13:56:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-29-applyedits-callback-before-visible-on-the-map/m-p/1377504#M83530</guid>
      <dc:creator>michaelpoa</dc:creator>
      <dc:date>2024-02-02T13:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: 4.29 - ApplyEdits callback BEFORE visible on the MAP ISSUE</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-29-applyedits-callback-before-visible-on-the-map/m-p/1377527#M83532</link>
      <description>&lt;P&gt;Example of ArcGIS mapView being stuck when processing too much data. Because view.updating + applyEdits callback != drawn on the map.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/michaelk95/pen/YzgLzaZ?editors=1000" target="_blank" rel="noopener"&gt;https://codepen.io/michaelk95/pen/YzgLzaZ?editors=1000&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 13:57:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-29-applyedits-callback-before-visible-on-the-map/m-p/1377527#M83532</guid>
      <dc:creator>michaelpoa</dc:creator>
      <dc:date>2024-02-02T13:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: 4.29 - ApplyEdits callback BEFORE visible on the MAP ISSUE</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-29-applyedits-callback-before-visible-on-the-map/m-p/1377692#M83535</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I did not quite exactly follow the issue you are reporting here. It seems like the problem is applyEdits performance when being called frequently? If so applyEdits method is not meant to be used with such high frequency. If you are updating feature frequently then consider using StreamLayer instead.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This document talks about different ways of creating stream layer:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#creating-a-streamlayer" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#creating-a-streamlayer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 18:06:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-29-applyedits-callback-before-visible-on-the-map/m-p/1377692#M83535</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2024-02-02T18:06:43Z</dc:date>
    </item>
  </channel>
</rss>

