dburles / meteor-collection-helpers

⚙️ Meteor package that allows you to define helpers on your collections
https://atmospherejs.com/dburles/collection-helpers
MIT License
498 stars 31 forks source link

Subsequent Helper Not Working #48

Closed merlinstardust closed 8 years ago

merlinstardust commented 8 years ago

I have collections: As, Bs, Cs. And I've written helpers like so

As.helpers({
  bs: function () {
    return Bs.find(_id: {$in: this.bIDs}});
  }
});
Bs.helpers({
  cs: function () {
    return Cs.find(_id: {$in: this.cIDs}});
  }
});

And I have templates like so

<template name="AList">
{{#each as}}
  {{> ASingle}}
{{/each}}
</template>

<template name="ASingle">
A Name: {{name}}
{{> BList}}
</template>

<template name="BList">
{{#each bs}}
  {{> BSingle}}
{{/each}}
</template>

<template name="BSingle">
B Name: {{name}}
{{> CList}}
</template>

<template name="CList">
{{#each cs}}
  {{> CSingle}}
{{/each}}
</template>

<template name="CSingle">
C Name: {{name}}
</template>

On my HTML page, I see a list of all the As and their names with their nested Bs and their names. But I do not see a list of the nested Cs within the B groups. I do see the text "C Name: " just once but there's nothing next to it.

Also, I have console log functions in the Bs helper to get cs and I don't see any log statements on server or client.

Am I trying to nest too many helpers? Is this even possible?

Issues it's not:

dburles commented 8 years ago

hey @merlinpatt I can't see why it'd be a problem. Are you able to create a simple reproduction app I can take a look at?

merlinstardust commented 8 years ago

I figured out the problem. Instead of cIDs, I just had the field name called cs, which would conflict with the helper name. Thank you for the super fast response though!