WHOIGit / ifcbdb

IFCB dashboard
MIT License
8 stars 9 forks source link

bin markers disappear on map when user clicks 'next bin' or 'previous bin' button #335

Closed hsosik closed 2 months ago

hsosik commented 2 years ago

There seems to be a display problem on the map if the user navigates between samples with the next/previous bin buttons. Any bin markers that have already been viewed this way no longer show up on the map.

You can see this behavior by following these steps:

  1. navigate to this bin (for example) https://ifcb-data.whoi.edu/timeline?dataset=NESLTER_broadscale&bin=D20160708T122654_IFCB101
  2. Zoom in on the map to see the bin marker clearly separated from those nearby
  3. Click 'next bin' a few times and you'll see that the markers will disappear from the map for any bins you've already viewed
mike-kaimika commented 2 months ago

This one should be working properly now. The prior logic was attempting to reuse the selected marker (the one that shows in a different color) when putting it back in the original list. However, in doing so, when subsequent code cleared the select marker (to replace it with another one), it appeared to still have a handle to that marker, and would delete it. The net result is that the marker for the last bin would be removed, and never appear on the map.

The new logic takes the select marker, and copies it, rather than reusing the old one. It will then not get caught in any garbage collection, for lack of a better term, and will show on the map properly

Updated Files https://github.com/WHOIGit/ifcbdb/pull/402