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.

Converting circular structure to JSON

See original GitHub issue

Environment

Please provide as many details as you can:

  • Formio.js version: 4.5.1
  • Frontend framework: 4.8.1
  • Browser: Chrome
  • Browser version: latest

Steps to Reproduce

https://angular-formio-custom-demo.netlify.com/

  1. Add a Table component.
  2. Add any component. The components will disappear.
  3. Add any component again. This error message will appear in console: Infinite loop detected undefined 500

Expected behavior

No error message, no circular reference.

Observed behavior

Circular reference, error message in console.

I cannot reproduce our issue with the demo app (only the infinite loop), but internally we get this error message:

Uncaught TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    --- property 'component' closes the circle
    at JSON.stringify (<anonymous>)
    at fastCloneDeep (utils.js:1350)
    at TableComponent.get (Component.js:2883)
    at get (<anonymous>)
    at TableComponent.get (NestedComponent.js:730)
    at get (<anonymous>)
    at TableComponent.get (Table.js:85)
    at Webform.js:1783
    at NestedComponent.js:198
    at arrayEach (lodash.js:516)

Example

https://angular-formio-custom-demo.netlify.com/

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
merobalcommented, Apr 1, 2020

@travist FYI I realized the issue, in this case, was I saved the form to a local model and I passed back to the formio component.

So the fix for my demo is: https://github.com/merobal/angular-formio-custom-demo/commit/1a4a96280637b986997388e05aa2662d71e957fd

FYI https://github.com/formio/angular-formio/issues/509 @ullas1989 FYI https://github.com/formio/angular-formio/issues/507 @dmenne

1reaction
travistcommented, Mar 17, 2020

Thanks for the bump… I will ensure this is added to a developer on our teams list this week, or maybe early next week.

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 >
TypeError: Converting circular structure to JSON - Stack ...
TypeError: Converting circular structure to JSON. It seems that I can get the object logged to the console by using just plain: console.log(object)....
Read more >
Converting Circular Structure to JSON - Career Karma
Circular JSON serializes and deserializes otherwise valid JSON objects containing circular references into and from a specialized JSON format.
Read more >
TypeError: Converting circular structure to JSON in JS
The "Converting circular structure to JSON" error occurs when we pass an object that contains circular references to the JSON.stringify() method.
Read more >
How to print a circular structure in a JSON like format using ...
The circular structure is when you try to reference an object which directly or indirectly references itself. ... Here you can easily resolve...
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