Closed AaronONeill closed 7 years ago
I've done a bit more investigations on this and have narrowed it down a bit.
For the scenario (based on the example code above) where you go from Continent View to Worldview and then try to change the state via the "Change Labels" button the issue is in line 150 of amcharts3-react.js.
It is trying to access a key which the object does not have:
if (updateArray(obj[key], x, y)) {
didUpdate = true;
}
This was easily fixed by checking obj.hasOwnProperty(key))
.
The second scenario is in the same area but a different issue. Under the scenario of going from Worldview to Country view and then updating the state the issue arises when setting the key for 'images'. The object is undefined. However it is an array of objects and the comparison on line 144 if (x !== y)
is failing. (They are the same). Thus if this check was working correctly then it would never get to call updateArray(obj..).
Hope this helps.
Joe
@AaronONeill Thanks for reporting this!
@joesken Thanks for the detailed information!
I'll look into fixing this ASAP.
@AaronONeill Sorry for the wait, I have fixed this in version 2.0.3
Hi,
I have been building a prototype for a drilldown map (continents -> world -> country) and I have added labels at each stage which is working correctly.
I am now trying to update the maps labels (images) via a button click. The button simply updates the state where the label text is coming from. This is working fine if I click the button on the "Continent" view however if I click on "North America" for example, the map switches to World view and if I now click on the Update Labels button, it causes the following error:
Below is the React application so far:
Here is the HTML page which displays the map (attached is the index.html with JS):
app.zip