Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute 'querySelectorAll' on 'Element': '#celestial*' is not a valid selector. #100

Open
fmilioni opened this issue Sep 14, 2020 · 2 comments

Comments

@fmilioni
Copy link
Contributor

fmilioni commented Sep 14, 2020

If you call the display function twice, the following error occurs:
Failed to execute 'querySelectorAll' on 'Element': '#celestial*' is not a valid selector.

The problem started after this commit: 9bae16e. It's looks like the selector is invalid at this line:

if (container) container.selectAll(parentElement + "*").remove();

(if you do a basic test with document.querySelectAll('#celestial*'), the same problem will occur.)


I did a temporary fix in my code using this snippet:

Captura de Tela 2020-09-14 às 19 25 54

@ofrohn
Copy link
Owner

ofrohn commented Sep 15, 2020

Yeah, there was a space missing. Should be fixed now

@fmilioni
Copy link
Contributor Author

@ofrohn
Looks like it's not working properly yet. It does fix the selector but not everything is being deleted from the DOM. I'm using version 0.7.34.

Captura de Tela 2020-09-17 às 10 05 32

My temp workaround

useLayoutEffect(() => {
    //  FIXME  remove celestial-form
    const form = document.getElementById('celestial-form');
    if (form) form.remove();

    celestial.display(cfg);
  }, [options]);

I'll release d3-celestial as a react component soon, i'm very excited =)

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

No branches or pull requests

2 participants