visjs/vis-data

Feature request: Add a destroy method to the dataset

AlexDM0 opened this issue · 0 comments

Hi guys, I've been working on a project with the vis-timeline and the dataset in a react environment. When the component gets removed, I'd like to destroy the datasets along with the timeline.

The timeline (and other vis components) have a destroy method, which removes all data and event listeners.

Sure, the timeline destroy will remove the event listeners it has on the dataset. If I remove the datasets first (clear(), flush()?) first, this would trigger a redraw of the timeline, which is also in the process of being destroyed. This introduces a race condition I could solve, but ideally would want to sidestep by a destroy method on the dataset itself.

What do you guys think?