I'm working my way through the Discover Meteor tutorial and an annoying problem keeps popping up. When I use the console to change app data, the app doesn't update automagically for reactive data sources as promised. Not sure what is going on. Here's an example to illustrate the problem (and to figure out whether it's the code itself or something else).
Initialize app and include underscore and iron router:
meteor create testApp
meteor add underscore
meteor add iron:router
Create the 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 for SO</h1>
</div>
</template>
Now run the app from the testApp
directory using the meteor
command and navigate to localhost:3000
in the browser.
Now type Session.set('pageTitle', 'New Title');
into the console.
I am using Chrome and when I do this, the terminal window where I'm monitoring the meteor server prints out Client modified -- refreshing
. However, nothing happens, even though the Session
object is supposed to be reactive. Then, if I refresh the tab, I get a blank screen and have to restart the meteor server manually if I want to get my app to work again.
Does anyone know what's going on here?