I’ve got an
autorun that checks to see if my leaflet maps template is loaded (from CDN), if it is, it executes a callback. That callback includes an
observeChanges where the
added callback puts all the markers in my DB on the map.
The problem is when a document is removed. The remove causes the cursor to change, causing a stop in the
observeChanges and an invalidation in the
autorun, which causes the
observeChanges to be rerun, thus double markers. If this is correct, I understand WHY it’s happening, but not how to fix it.
My goal is to remove a marker without triggering an invalidation (not just clear a layer, because my map could have over 10,000 markers). Is there a pattern to accomplish this? If i
stop() the computation after running the callback, it stops the
observeChanges comp as well, so that’s no good. My only thought is to get rid of the
autorun, which means I’d have to find another way to make sure leaflet is loaded before I need it, or just load it locally. Suggestions?