clartaq / cwiki

A personal wiki written in Clojure/Script
Other
3 stars 0 forks source link

Pervasive "Target container is not a DOM element." warnings #13

Closed clartaq closed 4 years ago

clartaq commented 4 years ago

When navigating among pages in CWiki, I constantly see this warning. No idea why or where it comes from.

clartaq commented 4 years ago

For awhile now, I have been getting persistent errors from React about "Uncaught Error: Target container is not a DOM element". This seems to be related to the reloading function used after the editor is exited.

The error message is not particularly helpful, but seems to be generated by the react render in the cwiki-mde.core/reload function.

That function is called by figwheel every time code is loaded. On a page reload it appears that the function gets called twice.

In normal use, the function is usually called when I press the "Done" button in the editor.

When running from an uberjar, when figwheel should not be present at all, exiting the editor still causes the issue, but with a slightly different message. This time the message comes from minified react and links to a web page with essentially the same message about attempting to render something that is not a DOM element.

Putting a simple guard in the function to check for the outer-editor-container element seems to fix things.

clartaq commented 4 years ago

Resolved by commit referenced above.