john-guerra / navio

A d3 visualization widget to help summarizing, exploring and navigating large network visualizations
https://navio.dev
MIT License
106 stars 13 forks source link

how to remove the popup when the navio is dismounted? #39

Closed Fil closed 3 years ago

Fil commented 3 years ago

Currently if you have a popup and you dismount the navio, the popup stays on the page.

Here's a video to explain the issue—the issue can happen in observablehq if you refresh the navio cell or if the underlying data updates. Because the nv_popover is added to the body of the page it is not properly removed when the navio component is removed.

https://user-images.githubusercontent.com/7001/118958615-dddac380-b961-11eb-83da-269fcc152502.mov

Fil commented 3 years ago

maybe it's simply because a dot is missing on this call https://github.com/john-guerra/navio/blob/master/src/navio.js#L130

Fil commented 3 years ago

I can "fix" my observable cell by removing the popover when I create a new navio. Not perfect but it works for my case.

{
  d3.select("body").selectAll("._nv_popover").remove();
  return navio(datasets.get(source)||[])
}

(as you can see it happens a lot since I have an interface to change the dataset source)

john-guerra commented 3 years ago

Should be fixed on navio@0.0.67

Can you please test it @Fil ?

Fil commented 3 years ago

Perfect! ¡Gracias!