Open PaulieScanlon opened 10 months ago
Sorry, this is actually an issue. Looking at the DOM, there are duplicate elements, in my case when I re-render I'm showing and hiding the same point by use of a checkpoint. Rather than adding and removing it, it looks like it just gets added, and added again.
Do you have any top tips to "clean up" or remove all existing htmlElement
markers on each state update?
@PaulieScanlon only the entries that are at any given time in your htmlElementsData
should have corresponding elements in the dom. If you replace an array with another, all of those elements that are not present in the last array will be removed from the dom.
If this is not the behavior you're observing it would be a malfunction, but I am unable to reproduce your case.
So, if the issue persists, would you mind making a simple example on https://codesandbox.io/ that shows it?
Thanks! I've since changed the idea slightly so I don't need to show or hide anything, and you're right, with a new array of data, all is ok. It was when I was attempting to filter, and return a new array that I ran into problems. I don't know why there would be a difference because the filtered array was also technically a new array.
I'll see if I can create a CodeSandbox. Thanks for the response!!
Describe the bug I'm initially setting a few default markers using
htmlElement
. When a user does something I pass an updated array tohtmlElementsData
.To Reproduce I've noticed that on the first load, all markers maintain their correct z-index and when the globe is rotated thet disappear as expected.
When a new array is passed in and the globe is re-rendered they lose this functionally and stay on top of the Globe when it's rotated.
Expected behavior any existing markers should maintain their z-index
Screenshots Initial render screenshot: Markers correctly disappear when the globe is rotated.
After state update screenshot: Markers don't disappear when the globe is rotated.
Desktop (please complete the following information):
Additional context Here's how i create the HTML markers.