I am using ArcGIS api JS with a layer of polygons. When I click on one polygon, it creates a layer of points that intersect the polygon clicked. When I then click on a point, the point gets highlighted correctly.
The problem is that once I have clicked at least once on a point and got it highlighted, if I then click on a polygon or anywhere else on the map where there is no polygons, this error occurs:
Uncaught (in promise) TypeError: Cannot read property 'setHighlight' of null
at d.f._updateHighlight (mapViewDeps.js:773)
at d.f.removeHighlight (mapViewDeps.js:773)
at Object.remove (GraphicsLayerView2D.js:7)
at d.c.remove ((index):751)
at d.<anonymous> ((index):2352)
at g ((index):38)
at Object.next ((index):37)
at new Promise (<anonymous>)
at Object.f [as __awaiter] ((index):36)
And when I then click again on a point, the point doesnt highlight anymore. But the popup works fine. One the highlight is not working.
I would like to know where is the poperty "setHighlight" and how can I avoid the issue?
If only I was able to pin point where the property is, I could probably undesrtand what is happening. But there is no info online about this property nor the issue.
So thank you for any of your help, it is really appreciated!
"TypeError" might occur if there is any issue with the code logic or incorrect naming convention, etc.
Also, "setHighlight" property is not an API reference property of a class, which we may think be corrupted, and hence, causing this issue.
Without a sample app, this issue might be difficult to troubleshoot further.
Thanks for your reply.
Here is a sample of my code. I tried to get ride of everything that would still reproduce the error:
I am so sorry, there is a small error in the code above. If you could replace the creation of the OGCFeatureLayer by this, it will work (I no longer use my local server!):
Just curious to know if you were able to pinpoint the cause of this error? I'm experiencing a similar `TypeError` as you described above, the main difference is that mine errors on the `attributes` prop.
Uncaught TypeError: Cannot read property 'attributes' of null
Any insight into this will be greatly appreciated!
Thanks in advance,