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.

Circular structure bug when referencing the $el in a different variable

See original GitHub issue

Referencing the $el in another object attribute will cause a bug when the devtool stringifies the object.

var component = function() {
  return(
    {
      msg: 'Hello Alpine.js',
      init() {
        this.div = this.$el 
      }
    }
   )
}

See this page here with the console opened: https://cdpn.io/pomartel/debug/abmbyNg/xJAjOeOZonJk The Codepen source here: https://codepen.io/pomartel/pen/abmbyNg

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

1reaction
HugoDFcommented, Nov 27, 2020

Solution here is probably to try to detect Alpine variables that are DOM Nodes and display “DOM Node” or “HTMLElement” instead of the actual value, a bit like we do for “function”

See the following codepen to detect HTMLElement https://codepen.io/hugodf/pen/OJRJwXJ

0reactions
HugoDFcommented, Dec 3, 2020

Here’s what the UI looks like btw, should be good enough for now, I get that having the devtools crash is probably the top priority.

Screenshot 2020-12-03 at 15 22 01
Read more comments on GitHub >

github_iconTop Results From Across the Web

What is TypeError: Converting circular structure to JSON?
TypeError : Converting circular structure to JSON occurs when you try to reference your variable name within the JSON object.
Read more >
How to fix circular reference in javascript object?
Consequently, we get a runtime error saying we have circular references: Uncaught TypeError: Converting circular structure to JSON ...
Read more >
TypeError: cyclic object value - JavaScript - MDN Web Docs
The JavaScript exception "cyclic object value" occurs when object references were found in JSON. JSON.stringify() doesn't try to solve them ...
Read more >
Converting circular structure to JSON when using package ...
This is a Bug Report Refs #3344 and #3467 /cc @HyperBrain ... structure to JSON when using package command with self reference #3509....
Read more >
Design-time errors in the Windows Forms Designer
Many error types include an exact location in the following format: [Project Name] [Form Name] Line:[Line Number] Column:[Column Number]. If a ...
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