从Deps afterFlush函数获取异常:如果我甚至不使用Deps及其autoFlush函数,则超出最大调用堆栈大小?

时间:2013-12-21 15:38:19

标签: meteor

每当我插入或删除某些内容时,我都会收到此消息(我调用服务器方法)。

我没有使用Deps,但我们对一些我没有做过的函数进行了无限递归调用。

Exception from Deps afterFlush function: RangeError: Maximum call stack size exceeded
    at http://localhost:4000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:363:13)
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:364:11)
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:364:11)
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:364:11)
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:364:11)
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:364:11)
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:364:11)
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:364:11)
    at recurse (http://localhost:4000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:364:11) 

这里有更多信息。我正在使用JQuery可排序插件,它允许我排序我的列表元素。 如果我重新排列元素,然后尝试删除它们,则只会出现上述错误。这是我的删除代码:

列表元素由名为index的唯一ID标识,如下所示:

<li id="{{index}}" class="list_element">

一旦我点击destroy,这就是事件处理程序:

Template.list.events({
    'click .destroy' : function (){
        console.log("this: "+this.index);
        Session.set("to_delete",this.index);    
        $("#"+Session.get("to_delete")).fadeOut('slow',function(){
            Meteor.call('delete_record',Template.list.my_playlist_id, Session.get("to_delete"), function(err,message){
                console.log("err from delete: "+err);
            });
        });
    }
  });

以下是在上面的事件处理程序中调用的服务器方法delete_record

delete_record: function(sessID, ObjID){
    console.log("trying to pull object "+ObjID +" from session: "+sessID);
    Links.update({sess: sessID}, {$pull: {songs: {index: ObjID}}});
    console.log("remaining songs: "+Links.findOne({sess: sessID}).songs.length);
    if(Links.findOne({sess: sessID}).songs.length == 0){
        console.log("list empty, destroying record with id "+sessID);
        Links.remove({sess: sessID});
    }
}

弹出错误后,程序中的一些内容出错了。我如何解决此问题?

EDIT;这可以在这里轻松复制:http://mixtape.meteor.com

0 个答案:

没有答案