Skip to content
This repository was archived by the owner on Jan 25, 2021. It is now read-only.
This repository was archived by the owner on Jan 25, 2021. It is now read-only.

subscribe(...).wait() in Router.onBeforeAction causes "You called wait() after calling ready() inside the same computation tree." #38

Description

@nleush

Looks like there is problem with this peace of code:

Router.onBeforeAction(function(pause) {
  var loadingTemplate;
  if (this.ready()) {

ready() causes error. I think this hook should be last in queue of hooks.

E.g. this is my code:

var mustBeSignedIn = function(pause) {
    this.subscribe('items').wait();
};

Router.onBeforeAction(mustBeSignedIn);

Router.map(function () {
    this.route('items', {
        path: '/'
    });
});

It produces this error:

Exception from Tracker recompute function: Error: 
You called wait() after calling ready() inside the same computation tree.
You can fix this problem in two possible ways:
...

But this version (without global hook) works ok:

Router.map(function () {
    this.route('items', {
        path: '/',
        onBeforeAction: mustBeSignedIn
    });
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions