Avoid exception when cursor was removed from DOM already #1834
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
we were getting a
NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node
from this call because the cursor had already been removed from the DOM.This happens in our case because we use noVNC together with Turbo. This is a library / framework that replaces parts of the page or the entire document with server side rendered content.
So when leaving the page with the connected noVNC on it, we need to call
rfb.disconnect()
to close the connection, since we remain in the same JS context. By the time we do that, the DOM is already replaced though, so the canvas is no longer indocument
and the error occurs.Since this line in noVNC is intended to remove the element from the DOM, we argue, that it is not an error if it was not in the DOM in the first place.
Thank you for your time and effort!