Code Monkey home page Code Monkey logo

Comments (5)

stubailo avatar stubailo commented on June 2, 2024

@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.

patrickml avatar patrickml commented on June 2, 2024

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.

stubailo avatar stubailo commented on June 2, 2024

@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.

patrickml avatar patrickml commented on June 2, 2024

Yeh I guess thats true thank you for you help!

from meteor-reactive-method.

stubailo avatar stubailo commented on June 2, 2024

No problem, thanks for asking!

from meteor-reactive-method.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.