javascript - Meteor Session object not behaving reactively -


i'm working way through discover meteor tutorial , annoying problem keeps popping up. when use console change app data, app doesn't update automagically reactive data sources promised. not sure going on. here's example illustrate problem (and figure out whether it's code or else).

initialize app , include underscore , iron router:

meteor create testapp meteor add underscore meteor add iron:router 

create following file structure:

. └── testapp    ├── .meteor    |  └── [meteor auto generated files]    ├── lib    |  └── router.js    └── client       ├── layout.html       ├── layout.js       ├── main.html       └── pageone.html 

router.js

router.configure({     layouttemplate: 'layout', }); router.route('/', {name:'pageone'}); 

layout.html

<template name="layout">     <div class="container">         <header class="navbar navbar-default" role="navigation">        <div class="navbar-header">         <a class="navbar-brand" href="{{pathfor 'pageone'}}">{{pagetitle}}</a>       </div>     </header>     <div id="main">       {{> yield}}     </div>     </div> </template> 

layout.js

template.layout.helpers({   pagetitle: function() { return session.get('pagetitle') || "placeholder"; } }); 

main.html

<head>     <title>testapp2</title> </head> 

pageone.html

<template name="pageone">   <div class="message">     <h1>test app so</h1>   </div> </template> 

now run app testapp directory using meteor command , navigate localhost:3000 in browser.

now type session.set('pagetitle', 'new title'); console.

i using chrome , when this, terminal window i'm monitoring meteor server prints out client modified -- refreshing. however, nothing happens, though session object supposed reactive. then, if refresh tab, blank screen , have restart meteor server manually if want app work again.

does know what's going on here?

when search repository session.get can't find hit, not using session variables... https://github.com/dantzlerwolfe/microscope/search?q=session.get

try example work , reconsider domain. thats not how meteor works...

template.postitem.helpers({     name: function() {         return session.get('pagetitle');     } }); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -