Circular references wheen include is >= 2
See original GitHub issueWhen setting a getEntries
with an include
of 2, I’m still getting circular references and being unable to JSON.stringify
it.
In addition, toPlainObject
does nothing, and stringifySafe
just blocks forever.
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Remove or allow a circular reference - Microsoft Support
Find and remove a circular reference. You can also learn about the circular reference warning message and iterative calculation in Excel.
Read more >Circular reference in Excel: how to find, enable, use, or remove
Learn the basics of Excel circular reference - how to check workbooks for circular formulas, and how to enable, find and remove circular ......
Read more >What Is Circular Reference in Excel? Everything You Need to ...
Circular reference is a type of error in Excel that occurs when a formula in a cell tries to calculate itself. Find out...
Read more >Circular reference - Wikipedia
A circular reference is a series of references where the last object references the first, resulting in a closed loop. Circular reference (in...
Read more >How to Find and Fix Circular References in Excel
A circular reference occurs when you end up having a formula in a cell – which in itself uses the cell reference (in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@cachrisman Hey thanks for your reply! I’m sending my response as JSON to the client to consume and therefore it’s stringify’d.
I actually have a circular reference on the 5th level deep. This is why I only want to include 4 levels deep and not resolve past that. So I would want the links to resolve down to the 4th level, the 5th being a of
{ type: 'link'}
The hierarchy is like this:
Countries -> Homepage -> Categories -> Sub Categories -> Asset Wrappers(this has the exclusiveCountry field which refs Countries)
This is starting to make sense though, and I see your point(in this case I actually might need to include 5 levels, but let’s keep it 4 for consistency sake).
This is probably a feature rather than a bug. Let me see if I’m understanding correctly.
The above doesn’t resolve any links at all, so you end up with
{ type: 'link'}
as properties instead of the associated Content Type object.I’m looking for something like this:
Expected Behavior:
Resolve all of the links up until the 4th level which is specified by the
include
parameter but do not resolve past that. So the 5th is a{ type: 'link'}
which avoids the circular ref.Current Behavior:
If
resolveLInks
is on, all links will be resolved that are included in the response, even if that includes circular JSON.Include
doesn’t have any effect on which links are resolved.Do I have that right? How feasible would this be?
From my perspective, if you don’t want to
include
past a certain level, why would you want toresolveLinks
past that level?Let me know if the above makes sense or if you need any more info.
Thanks!
There’s definitely a bug happening somewhere. Can we re-open this?
I’m currently using the Node Client(“contentful”: “^7.1.0”, node -v: v10.12.0) and getting the following error:
TypeError: Converting circular structure to JSON
I have a Asset Wrapper content-type which has a field called exclusiveCountries which refs Countries. So assetWrappers(CT): exclusiveCountries(field) -> Countries(CT, this will eventually reference assetWrappers)
My query looks like this:
I need exactly 4 levels of links resolved and nothing more. However, on the 4th level of content the links are still being resolved all the way down the hierarchy.
Expected behavior:
include parameter actually limits the links resolved to 4, even on a linked, references many content-type. I’m assuming that it’s also including 4 levels deep on that, which is throwing this error.
Happy to provide more info but trying to get the ball rolling again.