Closed patrickml closed 9 years ago
@patrickml I think your helper is actually called twice by Blaze.
You can get around this by using {{#with}}
, or explicitly making a new variable to cache the result of the method.
Here's a hack to call the helper only once with {{#with}}:
{{#with totalBalance}}
<tr>
<td>
Assets : {{money assets}}
</td>
<td>
Liabilities : {{money liabilities}} =
</td>
<td>
</td>
</tr>
{{/with}}
Though this works I still feel like if this package is caching the results it should return the result from the cache and not need to recall the method on the server unless the params change or the method is invalidated. Thank you for the awesome though it did work perfectly.
@patrickml yeah... but who know how long it should cache it for? Like, if you remove the template and then open it again 2 minutes later, the results from the server are likely to be different. If you need complicated caching I would suggest manually using a ReactiveVar and a Tracker.autorun to call the method when you need to. This package is just meant to satisfy the simplest use case in a convenient way.
Yeh I guess thats true thank you for you help!
No problem, thanks for asking!
For some reason my meteor methods are being called even if I dont update the params.
Look at this for example
HTML
JS
on the server I am seeing the following happen
Any Ideas?