Differential / meteor-boilerplate

Boilerplate meteor app - starting point for meteor apps
http://github.differential.com/meteor-boilerplate/
874 stars 179 forks source link

blaze-meta config not setting properly #83

Open aadamsx opened 9 years ago

aadamsx commented 9 years ago

I have the following code running in the /client directory, it doesn't set the company every time:

Tracker.autorun(function () {
  var config = Meteor.subscribe('public_configuration');
  if (config.ready()) {

    var company = configurations.findOne({ configuration_type: 'public' });
    console.log('meta config | company: ', company);

    if (company && company.company_name) {
      // Gets you 'Company Name' as a default title not 'Default Title'
      console.log('meta config | company name: ', company.company_name);
      Meta.config({
        options: {
          title: company.company_name,
          suffix: company.company_name
        }
      });
    }
  }
});

I get this from the Chrome console, so I know it's picking up company name and running the code:

meta config | company:  Object
meta-tracker.js:33 meta config | company name:  Test Inc.

On initial load it will not set, then if I refresh the page the company name will get set properly. Then if I hit refresh again, it will revert back to localhost:3000

What am I doing wrong?