Closed Jeffrey-Thompson closed 1 year ago
Hi @Jeffrey-Thompson ,
Sorry for the late response. We are unable to replicate the issue. Could you provide us an example of this? It could also help if you could provide version of ArcGIS Experience Builder / ArcGIS Javascript API used
BTW variable compareDate is not used within the stated useEffect and should not be included in the useEffect function to prevent any unwanted rendering.
Upon further investigation, the comparison map does load when switching dates (with compareDate removed from the callback array), but it sets itself to invisible.
Can you explain why there are two if statements checking if nearmapTrail is not undefined and setting visibility in opposite ways?
I am using Experience Builder Developer Edition 1.11 and 4.26 version of the API.
I just realized that you are using the widget within a widget controller which may be causing the issue. This will require some enhancement on my side for it. Will update once the enhancement has been done.
Hi @Jeffrey-Thompson , I have pushed the latest update to the repo
BTW I just realized that the issue faced might be related to some tile on the map does not have the image for that particular date. e.g. tile A has image for both May 2009 and June 2009 but tile B has image for only June 2009
The comparison map was not loading if I changed dates. I would need to close the comparison and then re-open to get the image to load. I added compareDate to the callback array in the useEffect function and that seems to have fixed it.
` // compare function useEffect(() => { if (errorMode === null && compare) { const nearmapLead: esri.Layer | undefined = jimuView.view.map.layers .filter((bs) => bs.id.includes('base-')) .at(0); const nearmapTrail: esri.Layer | undefined = jimuView.view.map.layers .filter((cp) => cp.id.includes('compare')) .at(0);
}, [compare, errorMode, jimuView, compareDate]);`