kadoshms / react-jvectormap

A react wrapper for jvectormap maps
MIT License
98 stars 70 forks source link

Proposed bug fix for issue #10 & #21 #121

Closed luis-neira closed 2 years ago

luis-neira commented 2 years ago

Regarding issue #10 & #21

I also experienced the same error when resizing the window and I think I found a possible solution.

Problem

The error come from the "applyAttr" method in the abstract-element.js file. Sometimes, when resizing the window, the "value" parameter receives NaN, which then throws an error.

Solution

I added an if block that wraps "this.node.setAttribute" method invocation and checks if the 'value' argument is not NaN. This way "setAttribute" receives the proper argument type. I have tested this implementation and it works on my local machine, but I don't know if this will conflict with anything else in the code base.

I hope this is helpful.

kadoshms commented 2 years ago

Looks great, merging

kadoshms commented 2 years ago

Change published to npm