Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

How to permanently delete lines from DOM? #16

Closed
olegkorol opened this issue Jul 10, 2018 · 9 comments
Closed

How to permanently delete lines from DOM? #16

olegkorol opened this issue Jul 10, 2018 · 9 comments

Comments

@olegkorol
Copy link

Hi,

I am trying to delete all leader-lines before unmounting a component in React.
After successfully invoking line.remove() and unmounting the component the lines are actually gone (they have been removed from the DOM).

But on screen resize the console gets full of:

A disconnected element was passed. index.js:2178
TypeError: n is null. leader-line.js:4:12474

As I understand, the lines (which supposedly do not exist anymore) are trying to find out the position of their respective start and end anchors (which of course do not exist anymore, since the component containing them has been unmounted).

Why could this be happening?
Isn't the method remove() the correct way to get rid of the lines?

Thanks a lot in advance!

@anseki
Copy link
Owner

anseki commented Jul 10, 2018

Hi @olegkorol, thank you for the report.
Could you show me example? e.g. using https://jsfiddle.net/

@olegkorol
Copy link
Author

Thanks for the quick response.
Could I send you a link to an email address @anseki ?

@anseki
Copy link
Owner

anseki commented Jul 10, 2018

Don't use email.
Please use an online service such as https://jsfiddle.net/ .

@olegkorol
Copy link
Author

It would take much time to reproduce it in jsfiddle.
I will try to debug it by myself, thanks for the help anyway.

@anseki
Copy link
Owner

anseki commented Jul 10, 2018

Ok 😄

@andyyatma
Copy link

Hi, did you solve the problem ?
i want to remove all line that i make before

@olegkorol
Copy link
Author

Sorry, that was a looong time ago - I do not remember anymore :(

@chesiren
Copy link

Hi @olegkorol, thank you for the report. Could you show me example? e.g. using https://jsfiddle.net/

hi, i found a way to reproduce the bug https://jsfiddle.net/xeq7cLn4/

when we delete both the lines and their anchor, and then resize the window it gives errors

@anseki
Copy link
Owner

anseki commented Apr 20, 2022

Hi @chesiren, thank you for the comment.
It seems that your code has bugs.
You mistakenly used remove method of DOM instead of LeaderLine, then the error was thrown caused by the incorrect DOM.
I fixed the bug in your code: https://jsfiddle.net/q8k30wa7/
See document: https://anseki.github.io/leader-line/#remove

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants