Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange difference between AppState and Session #4

Closed
steph643 opened this issue Oct 9, 2015 · 5 comments
Closed

Strange difference between AppState and Session #4

steph643 opened this issue Oct 9, 2015 · 5 comments

Comments

@steph643
Copy link

steph643 commented Oct 9, 2015

Consider the following code, using kadira:flow-router and kadira:blaze-layout (you can try it in this meteorPad):

<body>
</body>

<template name="myTemplate">
  <h4>Hello World</h4>
</template>
Tracker.autorun(function() {
  var template = AppState.get('template');
  BlazeLayout.render(template);
})

FlowRouter.notFound = {
  action: function() {
    AppState.set('template', 'myTemplate');
  }
};

This code doesn't work, i.e. myTemplateis never rendered.
But if you replace AppState by Session, it works correctly.

@steph643
Copy link
Author

steph643 commented Oct 9, 2015

This seems to relate to how the various packages manage their startup phases.

@luisherranz
Copy link
Owner

May I see your example of Session working?

Because it's not working here:
http://meteorpad.com/pad/pEBfkfmBofzMDCwf7/

It looks like the first Blaze.layout call won't work unless it's wrapped in a Meteor.startup callback.

Meteor.startup(function(){
  Tracker.autorun(function() {
    var template = Session.get('template');
    BlazeLayout.render(template);
  });
});

I will keep experimenting with this anyway.

@steph643
Copy link
Author

steph643 commented Oct 9, 2015

You are right, it doesn't wotk with Session either. Sorry for this.

@steph643
Copy link
Author

steph643 commented Oct 9, 2015

For those landing here, the BlazeLayout issue is tracked here.

@luisherranz
Copy link
Owner

No problem :)

I will close this, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants