【发布时间】:2017-02-21 18:41:44
【问题描述】:
我对 Meteor 很陌生。我正在做简单的应用程序。 这是我遇到的问题:
Template.newFeedForm.events({
'submit #new-feed-form'(event) {
event.preventDefault();
const target = event.target;
const text = target.text;
Meteor.call('feeds.insert', text);
target.text.value = '';
}
});
所以我有 newFeedForm 模板,在我的 feeds.js 中有
Meteor.methods({
'feeds.insert'(text){
check(text, String);
//check(hashtag, String);
// Make sure the user is logged in before inserting a task
if (! this.userId) {
throw new Meteor.Error('not-authorized');
}
console.log(this.userId);
// Feeds.insert({
// text: text,
// owner: this.userId,
// username: Meteor.users.findOne(this.userId).username,
// createdAt: new Date()
// });
}
});
我在这里注释掉了 Feeds.insert,认为它会导致问题。好像有什么不一样的。 每当 Meteor.call 被执行时,我都会得到这个:
Uncaught RangeError: Maximum call stack size exceeded
at Function._.(anonymous function) [as isArguments] (http://localhost:3000/packages/underscore.js?hash=cde485f60699ff9aced3305f70189e39c665183c:1068:30)
at Object.EJSON.clone (http://localhost:3000/packages/ejson.js?hash=0f17ced99d522d48cd8f8b2139167fd06babd969:512:25)
at http://localhost:3000/packages/ejson.js?hash=0f17ced99d522d48cd8f8b2139167fd06babd969:531:22
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?hash=cde485f60699ff9aced3305f70189e39c665183c:157:22)
at Object.EJSON.clone (http://localhost:3000/packages/ejson.js?hash=0f17ced99d522d48cd8f8b2139167fd06babd969:530:5)
at http://localhost:3000/packages/ejson.js?hash=0f17ced99d522d48cd8f8b2139167fd06babd969:531:22
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?hash=cde485f60699ff9aced3305f70189e39c665183c:157:22)
at Object.EJSON.clone (http://localhost:3000/packages/ejson.js?hash=0f17ced99d522d48cd8f8b2139167fd06babd969:530:5)
at http://localhost:3000/packages/ejson.js?hash=0f17ced99d522d48cd8f8b2139167fd06babd969:531:22
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?hash=cde485f60699ff9aced3305f70189e39c665183c:157:22)
不知道发生了什么。 这是我的 repo,它重现了这个错误: https://github.com/yerassyl/nurate-meteor
【问题讨论】:
-
您是否导入错误?如给定的那样,您的代码不应该抛出该错误。您是否通过调试器运行过它?
-
您确认您只输入了一次提交处理程序吗?
标签: meteor