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

Data & waitOn functions called more than once #152

Open
ahmedmelhady7 opened this issue May 14, 2016 · 0 comments
Open

Data & waitOn functions called more than once #152

ahmedmelhady7 opened this issue May 14, 2016 · 0 comments

Comments

@ahmedmelhady7
Copy link

ahmedmelhady7 commented May 14, 2016

Hi,

I have the below route, and I do not understand why it gets called more than one time first returning the actual value and then returning undefined.

Router.route('/trainee/:_id', {
    name: 'traineePage',
    template: 'traineePage',
    data: function(){
        var currentTraineeId = this.params._id;
        console.log("data function "+ Meteor.users.findOne({_id: currentTraineeId}));
        return Meteor.users.findOne({_id: currentTraineeId});
    },
    waitOn: function(){
        var currentTraineeId = this.params._id;
        console.log("waitOn function "+ currentTraineeId);
        return Meteor.subscribe('traineePlans', currentTraineeId)
    }
})

I get this in the console

waitOn function nTi7xgcqg4cGZcYSn
routes.js:73 data function [object Object]
routes.js:78 waitOn function nTi7xgcqg4cGZcYSn
routes.js:73 data function [object Object]
main.js:84 traineePage.helpers.traineeName elhadiahmed
main.js:92 traineePlans.helpers.plan [object Object]
routes.js:73 data function undefined
main.js:84 traineePage.helpers.traineeName elhadiahmed
main.js:84 traineePage.helpers.traineeName undefined
main.js:92 traineePlans.helpers.plan [object Object]
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

1 participant