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.

Error when using component in collection loop

See original GitHub issue

I get an error when I use a component within a loop of a collection. The same components works fine outside the loop.

Index.html

<main>
  
  {% bookshop "hero/base" title: 'My title' %}

  <section class="index-sloepen">
    {% for item in collections.sloepen %}
      {% bookshop "hero/base" title: 'My title' %}
    {% endfor %}
  </section>

</main>

Console output:

`RenderError` was thrown
> Converting circular structure to JSON
    --> starting at object with constructor 'EleventyExtensionMap'
    |     property '_engineManager' -> object with constructor 'TemplateEngineManager'
    |     property 'engineCache' -> object with constructor 'Object'
    |     property 'html' -> object with constructor 'Html'
    --- property '_extensionMap' closes the circle

I simplified it for this post, but eventually I want to pass data from my collection items to the component and render a component for each item in the collection.

I tried using a component in a frontmatter forloop, which works fine. When I loop over a collection it breaks.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
silveltmancommented, Jun 19, 2022

All works fine! Much love ❤️

1reaction
bglwcommented, Apr 13, 2022

Darn. I’ll have another dig, that trace gives me a good idea of where it’s happening, thanks 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

VueJS: Error when looping through data array with component
you have not defined posts in your #special-posts-container Vue object. you are passing a variable to another component without declaring it ...
Read more >
"Loop must iterate over a collection type" Error
I am getting the error "Loop must iterate over a collection type: SOBJECT: ROI__c" coming from the second loop in the excerpt below....
Read more >
Infinite loop when error is thrown in render method. #8653
There is an infinite loop when there are components with error on render and with onMount callback, which calls update of parent component....
Read more >
Overview of Loop components in Teams - Microsoft Learn
These are just a few scenarios made easier with Loop components. ... are available for search and collection in both eDiscovery (Standard) ...
Read more >
TypeScript For Loops - TutorialsTeacher
The for...of loop returns elements from a collection e.g. array, list or tuple, and so, there is no need to use the traditional...
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