Getting a weird error every once in a while for a hitTest function (still using 4.4 to avoid another bug but it happens in 4.6 as well).
EDIT: confirmed in Esri samples this a bug with the hitTest function. This seems to be fixed if i test in 4.7.
view.then(() => {
view.whenLayerView(nbhdLyr).then(function(lview2){
watchUtils.whenFalse(lview2,"updating",function(){
view.on("pointer-move",eventHandler2);
function eventHandler2(event) {
view.hitTest(event).then(getGraphics2);
}
});
});
});<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>It then passes to a function that sends attributes to a popup
<SPAN class="keyword token">function</SPAN> <SPAN class="token function">getGraphics2</SPAN><SPAN class="punctuation token">(</SPAN>response2<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>response2<SPAN class="punctuation token">.</SPAN>results<SPAN class="punctuation token">.</SPAN>length<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> graphic <SPAN class="operator token">=</SPAN> response2<SPAN class="punctuation token">.</SPAN>results<SPAN class="punctuation token">.</SPAN><SPAN class="token function">filter</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>result2<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">return</SPAN> result2<SPAN class="punctuation token">.</SPAN>graphic<SPAN class="punctuation token">.</SPAN>layer <SPAN class="operator token">===</SPAN> nbhdLyr<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>graphic<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> attributes <SPAN class="operator token">=</SPAN> graphic<SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> nbdattr <SPAN class="operator token">=</SPAN> attributes<SPAN class="punctuation token">.</SPAN>NEIGHBOURHOOD<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> poattr <SPAN class="operator token">=</SPAN> attributes<SPAN class="punctuation token">.</SPAN>PREORDERS<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> cusattr <SPAN class="operator token">=</SPAN> attributes<SPAN class="punctuation token">.</SPAN>CUSTOMERS<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> intattr <SPAN class="operator token">=</SPAN> attributes<SPAN class="punctuation token">.</SPAN>INTERESTLEVEL<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> mrkattr <SPAN class="operator token">=</SPAN> attributes<SPAN class="punctuation token">.</SPAN>MARKETPEN<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> addrattr <SPAN class="operator token">=</SPAN> attributes<SPAN class="punctuation token">.</SPAN>PROPERTIES<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> pconvattr <SPAN class="operator token">=</SPAN> attributes<SPAN class="punctuation token">.</SPAN>POCONV<SPAN class="punctuation token">;</SPAN>
document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"info"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>style<SPAN class="punctuation token">.</SPAN>visibility <SPAN class="operator token">=</SPAN> <SPAN class="string token">"visible"</SPAN><SPAN class="punctuation token">;</SPAN>
document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"nbhd"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>innerHTML <SPAN class="operator token">=</SPAN> nbdattr<SPAN class="punctuation token">;</SPAN>
document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"preorders"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>innerHTML <SPAN class="operator token">=</SPAN> <SPAN class="string token">" <b>"</SPAN> <SPAN class="operator token">+</SPAN> poattr <SPAN class="operator token">+</SPAN> <SPAN class="string token">"</b> preorders"</SPAN><SPAN class="punctuation token">;</SPAN>
document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"customers"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>innerHTML <SPAN class="operator token">=</SPAN> <SPAN class="string token">" <b>"</SPAN> <SPAN class="operator token">+</SPAN> cusattr <SPAN class="operator token">+</SPAN> <SPAN class="string token">"</b> customers"</SPAN><SPAN class="punctuation token">;</SPAN>
document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"interest"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>innerHTML <SPAN class="operator token">=</SPAN> <SPAN class="string token">" <b>"</SPAN> <SPAN class="operator token">+</SPAN> intattr <SPAN class="operator token">+</SPAN> <SPAN class="string token">"%</b> total interest"</SPAN><SPAN class="punctuation token">;</SPAN>
document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"marketpen"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>innerHTML <SPAN class="operator token">=</SPAN> <SPAN class="string token">" <b>"</SPAN> <SPAN class="operator token">+</SPAN> mrkattr <SPAN class="operator token">+</SPAN> <SPAN class="string token">"%</b> market penetration"</SPAN><SPAN class="punctuation token">;</SPAN>
document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"address"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>innerHTML <SPAN class="operator token">=</SPAN> <SPAN class="string token">" <b>"</SPAN> <SPAN class="operator token">+</SPAN> addrattr <SPAN class="operator token">+</SPAN> <SPAN class="string token">"</b> addresses"</SPAN><SPAN class="punctuation token">;</SPAN>
document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"poconv"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>innerHTML <SPAN class="operator token">=</SPAN> <SPAN class="string token">" <b>"</SPAN> <SPAN class="operator token">+</SPAN> pconvattr <SPAN class="operator token">+</SPAN> <SPAN class="string token">"%</b> preorders converted"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>This will sometimes give an error on the hitTest function, saying:
Uncaught TypeError: Failed to execute 'elementFromPoint' on 'Document': The provided double value is non-finite.
Image is also attached. I'm not sure what's causing this or how to get around it, anyone see this issue or have any thoughts?