I want to rerender a blockhelper when a session variable changes.
UI.registerHelper "myHelper", () ->
this.changedSession = Session.get 'someSessionVariable'
return Template.myTemplate
The helper is actually executed but the view is not updated. Ideally only the part that the helper renders would be rerendered (Template.myTemplate). But rerendering the complete page would also be an option.
How can I do this?
A very simple app that illustrates my problem:
The CoffeeScript:
if Meteor.isClient
Template.hello.greeting = () ->
Session.get "greeting"
UI.registerHelper "myHelper", (options) ->
this['greeting'] = Session.get 'greeting'
return Template.test
The HTML:
<template name="hello">
{{greeting}}
{{#myHelper test="test" more="more"}}
{{/myHelper}}
</template>
<template name="test">
{{this.greeting}}
</template>
If I change the session variable. The greeting itself is updated, the template containing the greeting is not updated.
I know this is not the meteor way to get the session in the helper, but I am using this for a prototyping framework and this helper can be used in any template without defining a data context for the helper.