funkyeah
funkyeah

Reputation: 3174

how to find where template variable is coming from in meteor.js

In someone elses meteor app code they have some thing like the following:

<template name="null">
   {{>main}}
</template>

<template name="main">
    {{#if some_user}}
       text or whatever
    {{/if}}
</template>

But no where in their client code do they have a Template.null and they define only one helper for main e.g.

Template.main.mode
   return Session.get('mode')

some_user does exist but I can't figure out where it is coming from. I searched through all the projects files and currentUser is only defined in the template so I assume its the property of some object that is returned. What is the best way to figure out where it is coming from?

Upvotes: 1

Views: 148

Answers (2)

Michael
Michael

Reputation: 315

If the some_user helper is not defined anywhere in the code, then it's stub (incomplete) code.

To answer your other question about subscribe for core modules. If you have the default autopublish package installed, then the entire database is published including the user database. If you remove the autopublish package, then you'll only be able to see the user information for the logged in user. Unless you publish and subscribe to it.

I've been building a new app with Meteor for about a month. So I'm no where near an expert, but I hope this helps. Good luck!

Upvotes: 0

Sasquatch
Sasquatch

Reputation: 98

This is likely a package that is installed. Simply search the entire codebase including the directories under the .meteor folder for all calls to publish and you'll find it.

Upvotes: 1

Related Questions