Hi guys, I have a meteor project that is running at eventpage.meteor.com.
When I test in my machine the site works fine, but when I deploy to meteor.com a error occurs in the router.js throwing a “TypeError: Cannot read property ‘url’ of undefined”. But when I try execute the same code in the Chrome Console the data is correct.
just some background info why this can happen:
your url is maybe a reactive Var. Lets say it is.
A reactive Var for example is a Collection Object or a Session Var.
Meteor will run the code without looking if everything is there( thats a js thing)
and meteor will rerun it if something changes in that “computation”. in this case its your router function.
so by wraping around the if statement the code will only run if the url is there.
why is that a good thing?
for example if url is undfined you could show a “loading” template
@lampe thanks for the help with understanding what was happening, now I moved that piece of code to a UI.registerHelper and now it’s working fine (for my sanity’s sake).