Primitive not deleting from globe

1. A concise explanation of the problem you're experiencing.

A Cesium primitive is not deleting from the screen when scene.primitives.remove(primitive); is called.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

scene.primitives.remove(primitive);
does not remove the primitive from the globe. Doing removeAll() works, but I just want to remove that one, not both.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I have a mouse event listener that creates a circle with a radius based on how far you move your mouse. This is supposed to create and delete primitives that give a preview to how big the circle will be, however the deleting isn't working, so I end up with a ton of circular rings.

4. The Cesium version you're using, your operating system and browser.

Cesium 1.47, CentOs, Firefox

I realized that in between the double click listener and mouse move listener, my global variable that keeps track of the primitive somehow loses it geometryInstance. Why does that happen?

Unless there’s something else going on, scene.primitives.remove should remove the given primitive (I just tested it in this example where it removed the rectangle after 5 seconds).

scene.primitives.remove should return true if it successfully removed the primitive. Can you check that?

Also, instead of creating and deleting primitives every frame, a more efficient way would be to use a Callback property to update the circle’s radius, like in this example.

Thank you so much for your answer. Yes, it was returning false. I realized it was an issue of trying to set currentPrimitive = newPrimitive. Now I figured out a way to only have one, so I don't need to do that.
Thanks for your help though!