IDREsandbox / hatecrimemap

Full stack web application using GIS software to visualize harassment claim data from the US
http://hatecrimemap.com/
MIT License
3 stars 5 forks source link

Migrate React-leaflet v2 -> v3 and auto-update legend #69

Closed ChrispyLam closed 3 years ago

ChrispyLam commented 3 years ago

React-leaflet was completely rewritten to use React hooks in v3.

Had to change structure of our leaflet code, including cutting off rerendering at the MapWrapper level to avoid [hooks firing] lag. Controls (mapbar and legend) moved to HomePage to be able to access react-leaflet map hooks.

ChrispyLam commented 3 years ago

Sorry it took a long time, ran into a lot of issues with the new react-leaflet v3 and how it would rerender the GeoJSONs (due to immutable states), causing a lot of lag with the hovering and everything. Was a lot of headache to adapt the new library and work around the rerenderings, but maybe I'm not thinking about the components the right way (making the zooming for counties was a lot easier when I incorporated it as a Map control). Should tag this PR when merged as the react-leaflet v3 migration, so you can refer back to it when something isn't working or making sense.