Select to view content in your preferred language

Sketchwidget performs a lot of unexpected queries

736
3
Jump to solution
04-09-2022 03:56 AM
ChristopheSuter
Regular Contributor

Hi,

I'm having a quite unexpected behaviour with sketchWidget, which performs hundreds of queries (for snapping ?) even with snappingOptions disabled.

Here is a Codepen that shows it.

https://codepen.io/christophesuter/pen/zYpjVrm

Maps loads, and after 10 seconds Sketchwidget loads after an alert.

Is there any parameter in sketchWidget that I could you to prevent this ?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JoseBanuelos
Esri Contributor

Hello @ChristopheSuter ,

This is an issue with the SnappingControls widget, and is currently being worked on for 4.24. The widget is currently fetching the layer extent for all the layers on the Map, even if you disable feature snapping. This was originally reported in the following thread:

https://community.esri.com/t5/arcgis-api-for-javascript-questions/disabling-snapping-on-sketch-does-...

Unfortunately, the only way to resolve this is to use the SketchViewModel without Sketch and programmatically configure the SnappingOptions. This is of course not ideal for anyone working with the Sketch widget. This will be fixed for 4.24.

Thanks,

Jose

View solution in original post

0 Kudos
3 Replies
JoseBanuelos
Esri Contributor

Hello @ChristopheSuter ,

This is an issue with the SnappingControls widget, and is currently being worked on for 4.24. The widget is currently fetching the layer extent for all the layers on the Map, even if you disable feature snapping. This was originally reported in the following thread:

https://community.esri.com/t5/arcgis-api-for-javascript-questions/disabling-snapping-on-sketch-does-...

Unfortunately, the only way to resolve this is to use the SketchViewModel without Sketch and programmatically configure the SnappingOptions. This is of course not ideal for anyone working with the Sketch widget. This will be fixed for 4.24.

Thanks,

Jose

0 Kudos
ChristopheSuter
Regular Contributor

ok thanks for the reply

0 Kudos
esride-nik
Occasional Contributor

Hi @ChristopheSuter@JoseBanuelos,

I'm having the same problem using the Editor widget. We've made it an official bug in the meantime and hoping for a fix in 4.24.
Here's what I did to mitigate:

esriConfig.request.interceptors.push({
    urls: flUrls,
    before: (params: BeforeInterceptorCallbackParams) => {
        params.requestOptions.timeout = 1;
    },
});

Cancelling the requests from here doesn't seem to be possible, because we only get the AbortSignal from the RequestOptions , but not the AbortController. So I'm setting the timeout of the unwanted requests to 1 ms, causing the client to cancel the requests before anything downloads (probably still causing unwanted server load - but I didn't look into that).

Plus a bit of logic to update the interceptor regarding the "flUrls" (which are the feature layer URLs being 'blocked') when layer visibility changes (watcher on the visibility prop of every layer).

Hope this helps!
Cheers, Nik

0 Kudos