fac-17 / Generation-Change

Generation Change (Tech For Better Project)
https://generation-change.netlify.com/
1 stars 3 forks source link

Console bugs #131

Open samjam48 opened 4 years ago

samjam48 commented 4 years ago
samjam48 commented 4 years ago

So it seems we are doing something freaky with too much use effects and things going on in the leaflet maps js file. I didn't write any of it so a bit unsure what is useful or not...

also this code

useEffect(() => {
    layerRef.current.clearLayers();
    markersData.pop();
    markersData.forEach(marker => {
      L.marker(marker.latLng, { title: marker.title })
        .addTo(layerRef.current)
        .bindPopup(marker.title);
    });
  }, [markersData]);

Why the line markersData.pop();. It just seems bonkers that we are removing the last result from the list of markers to show. We are still showing the last result in the cards so why have we decided to remove it from the markers? It doesn't seem to cause any problems removing this line and showing all the markers but I feel this is so wierd there must be a reason for it...

xIrusux commented 4 years ago

Answer to your last comment is that this was just a quick fix. Through air table we get one result that is empty but for some reason has the long lat of the actual last marker (did not write that piece of code). This means it overlays that marker and does not show a valid title. Console log all markers and you will understand.

samjam48 commented 4 years ago

Wow, weird! Yea it looked like it was fine in the console and matched the results array but apparently not. But yea I don't want to break things messing with code that is doing stuff I don't understand because of stuff like this. (would be nice to have a clean console but life... 🙄)