fix: clear restartTimeout on destroy #77
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/invalid-child-in-posBefore"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In production, we create and destroy CodeMirror instances somewhat regularly, and see this error in our Sentry reports quite a lot:
RangeError: Invalid child in posBefore.Tracing it back, what seems to be happening is the following: The destroy() method clears
hoverTimeoutbut notrestartTimeout. So if arestartTimeoutwas scheduled before destruction, it fires on the old/destroyed view, causingstartHover()→posAtCoords()to fail with stale DOM references.By clearing
restartTimeouton destroy, this seems to resolve the rare race condition.Thanks for fixing that!