aframe-forcegraph-component icon indicating copy to clipboard operation
aframe-forcegraph-component copied to clipboard

Remove try catch

Open Juleffel opened this issue 7 years ago • 1 comments

Hi again ;)

I'm using aframe-forcegraph-component with react and it seems that the tooltips elements are sometimes not defined when remove is called, so it generates an error. To solve it, adding a try catch seems to be enough (the warn is obviously not necessary, and if they are not defined, it's not really a problem that they are not removed..)

remove: function () {
    // Clean-up elems
    try {
      this.state.infoEl.remove();
      this.state.tooltipEl.remove();
      this.state.subTooltipEl.remove();
    } catch (err) {
      console.warn('Removing aframe-forcegraph-component:', err.toString());
    }
  },

Juleffel avatar Aug 29 '18 13:08 Juleffel

Hey @Juleffel, nice to hear from you again. Thanks for the heads up, could you open a PR with the changes? Also agree that the console.warn is unnecessary in this case.

vasturiano avatar Aug 29 '18 22:08 vasturiano