Comments (5)
@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}}
from meteor-reactive-method.
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.
from meteor-reactive-method.
@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.
from meteor-reactive-method.
Yeh I guess thats true thank you for you help!
from meteor-reactive-method.
No problem, thanks for asking!
from meteor-reactive-method.
Related Issues (17)
- Comment: HOT 3
- Infinite loops result if arguments to method calls evaluate differently on each run of the function HOT 20
- Code evaluates key rather than check for its presence HOT 2
- Could i use reative method in iron-router? HOT 7
- [feature] - trigger method to rerun HOT 7
- Getting the same (old) result returned HOT 2
- Could I check ready (waiting) form server? HOT 2
- invalidate only works once, removes computation HOT 14
- Don't auto update when the Collection updated. HOT 4
- [Feature] - Template Helper HOT 1
- Migrate over to deanius:promise
- Not working with ReactJS HOT 3
- Error: Expects a function HOT 1
- A helper runs multiple times
- The helper only updates template on browser refresh
- using with mdg:validated-method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-reactive-method.