Publish loading more than once

Hi there!
I have akward problem. My collection/publish is loading three times on one page. Dou you have any idea?
I want to publish the “PLN” string, but my page load pulications more than once.

I have some subpages here, maybe that’s why it’s loading three times, but why on second and third loading my currency is “undefined” even though I have the same currencyId “zloty”?

Please post a simplified code snippet here, so that we can see what you are doing.

That’s a relly cutted snippet :wink:

In my html:

<template name="InvoicesEditEditForm">
  Total Amount:     {{cenka invoice_edits._id}} 
  {{currencyinfodetails222 invoice_edits.customerId}}
<template>

In my js:

Template.InvoicesEditEditForm.helpers({
    "cenka":function(invoiceId){
        cena = Invoices.findOne(invoiceId);
        cenkadwa = cena.totalAmount;
        cenkatrzy = cenkadwa.toFixed(2);
        return cenkatrzy;
    },
    "currencyinfodetails222":function(customerId){
        var customerek = Customers.findOne(customerId);
        var walutka = customerek.currency;
        walutka2=Currency.findOne(walutka);
        var walutaname = walutka2.name;
        return walutaname;
    },
});

And the “cenka” is work properly, byt the “currencyinfodetails222” isn’t.

Of course I have:

Meteor.subscribe("customers"),
Meteor.subscribe("invoice_edits", this.params.invoiceId),
Meteor.subscribe("currency"),

and

customers: Customers.find({}, {}),
invoice_edits: Invoices.findOne({_id:this.params.invoiceId}, {transform:function(doc) { var sum = 0; Invoices.find({ invoiceId: doc._id }).map(function(item) { sum += item.amount; }); doc.totalAmount = sum; return doc; }}),
currency: Currency.find({}, {}),

I see that it doesn’t take the object here of my currency. But… in the first time it takes… akward.

Are you using Iron Router? Maybe this SO post might help:

Yeah, I use iron:router. I’ll see - thx

EDIT:
Nope, It doesn’t help. :frowning:

There is no answer… It’s bad. Iron router fires data 3 times…
But I don’t know how to stop afetr loading data once :confused:

OK, I know what to do.
I need to add every publication of my collection to subpages. Now it works :slight_smile: