question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]: destroy() method didn't fully remove events

See original GitHub issue

version: latest: v-0.16.3.

important: update from v-0.15.9 to v-0.16.3 while keep everything same, the error will show in console:

Uncaught TypeError: Cannot read property 'frameElement' of null
    at r.getFrameOffset (grapes.min.js?a826:formatted:28973)
    at r.getElementPos (grapes.min.js?a826:formatted:28985)
    at r.getElementPos (grapes.min.js?a826:formatted:13792)
    at r.updateLocalPos (grapes.min.js?a826:formatted:13444)
    at r.onFrameUpdated (grapes.min.js?a826:formatted:13396)
    at I (grapes.min.js?a826:formatted:554)
    at eval (grapes.min.js?a826:formatted:566)
    at eval (grapes.min.js?a826:formatted:129)
    ....

This error show there is a errro in function getFrameOffset, near position: e.ownerDocument.defaultView.frameElement:

...
clearOff: function() {
   this.frmOff = null,
   this.cvsOff = null
},
getFrameOffset: function(e) {
   if (!this.frmOff || e) {
>>> var t = e ? e.ownerDocument.defaultView.frameElement : this.frame.el;
       this.frmOff = this.offset(t)
  }
  return this.frmOff
 },
getCanvasOffset: function() {
   return this.cvsOff || (this.cvsOff = this.offset(this.el)),
  this.cvsOff
}
...

Refer to This Code Line

Checking the error stack will track to This Code Line

Expected: no error reported. Impact: I do not get specific negitive impact, only show the error. Reproduce: I integrate with Vue usage + webpack, hard to really reproduce, to debug this probaly check:

  1. simply add check chain to avoid TypeError:
before: var t = e ? e.ownerDocument.defaultView.frameElement : this.frame.el;
after: var t= (e && e.ownerDocument && e.ownerDocument.defaultView &&  e.ownerDocument.defaultView.frameElement) || this.frame.el;
  1. if this frameElement is required, in what condition it will missing, and then cause error.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
emilsedghcommented, Jan 31, 2022

Thank you @artf ! 🙏

1reaction
emilsedghcommented, Jan 6, 2022

I agree that this needs to be reopened and fixed within the destroy function itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tooltips are not removed from DOM after destroy event
it is a bug in older version of Bootstrap, So to fix it in older version you can remove the $tip element by...
Read more >
Scripting API: Object.Destroy - Unity - Manual
Removes a GameObject, component or asset. The object obj is destroyed immediately after the current Update loop, or t seconds from now if...
Read more >
Possible bug in ColVis button — DataTables forums
destroy() will remove any event handlers it has bound but if you created others they won't be removed. It supposed to leave the...
Read more >
Excel VBA Events - An Easy (and Complete) Guide
Excel VBA Events allow you to run a macro when a specific event occurs. An event could be an action such as opening...
Read more >
GraphicsLayer | ArcGIS Maps SDK for JavaScript 4.25
Returns an event handler with a remove() method that should be called to stop listening for the event(s). Property, Type, Description. remove, Function,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found