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

Uncaught (in promise) TypeError: Cannot read property 'removeChild' of null #5038

Closed
curioustolearn opened this issue Jun 18, 2020 · 2 comments

Comments

@curioustolearn
Copy link

curioustolearn commented Jun 18, 2020

Describe the bug
When using svelte with Katex, the latter possible changes DOM (not sure about this) that cause the above error when I change the filter criteria for a list. I don't see this error if I don't use Katex.

Stack trace
  myfile.js:6949 Uncaught (in promise) TypeError: Cannot read property 'insertBefore' of null
    at insert (myfile.js:6949)
    at insert_dev (myfile.js:8519)
    at Object.mount [as m] (myfile.js:15287)
    at insert (myfile.js:8077)
    at update_keyed_each (myfile.js:8099)
    at Object.update [as p] (myfile.js:15161)
    at Object.update [as p] (myfile.js:14966)
    at Object.update [as p] (myfile.js:15438)
    at update (myfile.js:7618)
    at flush (myfile.js:7580)
insert @ myfile.js:6949
insert_dev @ myfile.js:8519
mount @ myfile.js:15287
insert @ myfile.js:8077
update_keyed_each @ myfile.js:8099
update @ myfile.js:15161
update @ myfile.js:14966
update @ myfile.js:15438
update @ myfile.js:7618
flush @ myfile.js:7580
Promise.then (async)
schedule_update @ myfile.js:7550
make_dirty @ myfile.js:8367
(anonymous) @ myfile.js:8402
(anonymous) @ myfile.js:15483
set @ myfile.js:12577
update @ myfile.js:12587
_callee$ @ myfile.js:15506
tryCatch @ myfile.js:5894
invoke @ myfile.js:6123
prototype.<computed> @ myfile.js:5946
asyncGeneratorStep @ myfile.js:14876
_next @ myfile.js:14878
Promise.then (async)
asyncGeneratorStep @ myfile.js:14876
_next @ myfile.js:14878
(anonymous) @ myfile.js:14878
(anonymous) @ myfile.js:14878
updateView @ myfile.js:15490
$$self.$$.update @ myfile.js:15593
update @ myfile.js:7614
flush @ myfile.js:7580
Promise.then (async)
schedule_update @ myfile.js:7550
make_dirty @ myfile.js:8367
(anonymous) @ myfile.js:8402
(anonymous) @ myfile.js:14189
set @ myfile.js:12577
input_change_handler @ myfile.js:14232

Information about your Svelte project:

  • Your browser and the version:
    Version 1.10.90 Chromium: 83.0.4103.97 (Official Build) (64-bit)

  • Your operating system:
    OSX 10.14.4

  • Svelte version
    I believe I am using svelte 3.23.2 (based on the Changelog.md file).

  • Whether your project uses Webpack or Rollup
    Parcel

Severity
Make svelte usage difficult, since it would not work with Katex, which is essential to the
content.

Additional context
I replied in another issue with this same problem. But that has been closed, so I am not sure if anyone is paying attention to it. The following is what works, which may give further idea about the issue.

I thought that destroying the problematic content and re-rendering from scratch should help (because svelte is having trouble updating the content). I, however, don't know how to do that. I searched about this, and it appears that putting content in a #if block and setting the if condition to false and and then true could work. I tried that, but by iteself that did not help me. I get the same error.

Then, I tried the solution suggested by @ciri in issue 2086. The file he mentions does not exist in svelte 3.23.2. But I found that content in both svelte/internal/index.js and svelte/internal/index.mjs. By itself, the solution did not work.

However, both of the above combined do work.

@antony
Copy link
Member

antony commented Jun 18, 2020

The issue you have raised relates to a library which makes modifications to the dom which Svelte isn't in control of. It's likely therefore that it maniplulates the dom in some way and doesn't clean up after itself, or you're not calling the cleanup method in onDestroy. Either way, this doesn't seem to be a problem with Svelte.

In addition, you're using Svelte with Parcel, which is fine, but adds another layer of complexity which we don't know about, and aren't able to support.

I'm going to close this issue as it doesn't relate to something we can fix, and would be better asked in chat. However, I would suggest that making a REPL to demonstrate your issue, so that we (and other contributors) can better understand the issue and play with the code in order to determine the cause.

I apologise if this answer isn't the one you want, we're certainly not ignoring you, there are just too many factors outside of our control here which are likely the root cause of your issue.

@antony antony closed this as completed Jun 18, 2020
@curioustolearn
Copy link
Author

@antony Thank you for your reply. From next time I will move to chat (I did not know about it). Your response was helpful. I realized that my component was not getting destroyed properly.

Thank you.

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