I’m having a strage behavior that I cannot explain or solve in any way.
In summary: in a parent child template relationship – messages and message – the child template helpers receive a larger dataset than the one the parent selected for them. In particular the child – message – receives both previous and current iteration datasets.
The flow is like this:
-
I have Channels and Messages collection
-
Click on a channel and get its messages
-
Messages template has a child template named
{{#if Template.subscriptionsReady}} {{#each messages}} {{> message}} {{/each}} {{else}} loading... {{/if}}message
to process the display phase of each message posted
.
The problem:
- Click on channel A and I got the messages and everything is correct. Messages template processes 3 records and message template receives 3 records to process.
- Then I click on channel B and I select the correct record set in the Messages template. But when I start to process each message in
message
template, I observe that it receives much more records than the ones contained in channel B. Using the log to trace what happens, it looks likemessage
template receives channel A and channel B records.
Did anyone experience a similar behavior?