Hey all, currently I have a map that is keeping track of some data and displaying a polygon. On click it shows a tooltip but the tool tip resets every time it polls for new data (15 seconds currently). Data is polled from the database and then scripted to create the new objects to populate the polygons. Is there a setting or something I'm missing to prevent this? If not, any advice or tricks to help me prevent this from happening?
I'm just making a guess here, but it sounds like you have a tooltip configured for a marker, and are constructing the markers based on some sort of query.
If that is indeed the case, then the tooltip exists as part of
props.layers.ui.marker[x].tooltip If your binding exists on any of the objects in that chain and resolves, then it replaces the old data with new data. In this event, the old tooltip would essentially be garbage-collected and removed from the UI - even if the data is the same as it was before the last polling event because the binding doesn't care about equality.
If you need data to be polled, but you don't expect it to change very often, I would instead set up a custom property to reflect what it is you want your markers to be, and place your binding on that custom property. Then, place a change script on that custom property along these lines:
if currentValue and currentValue.value != previousValue.value: self.props.layers.ui.marker = currentValue.value
The goal here is to have a custom property which updates with polling, but which only updates the
marker object when the underlying value is different then it was at the last poll event.
Close, but I have the script bound to the props.vector.polygon so it is re-rendering the entire polygon property (because the array is dynamic and ranges from 0-sometimes hundreds depending on whats been happening on the sites). Those polygons then have a unique tooltip based on the data received from the DB. These polygons can be added at anytime and usually get removed in 4-24 hours depending on said data. That being said, I could probably use the self prop to get this working by checking against the values i receive and values currently set.