observeChanges inside an autorun

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?

I don’t see why the remove would cause the observeChanges to stop. Can you please post some code?

OH gosh I feel like an idiot, when I was cleaning up the code for your reply I found a
Collection.find().count(); that I used to determine when the initial batch of docs was loaded (for future readers I made this Collection.find({reactive: false}).count();). I think this should solve my problem, thanks for forcing me to take a closer look @Steve!