Whenever I update current user, all collections are flushed (actually not)


#1

I’m developing a website with angular-meteor and I’ve faced a strange problem. On every page I have a chat block, the messages are stored in collection chatMessages and displayed correctly. The problem is that every time I edit current user (manual mongo document edition or updating inside meteor’s method) my app removes all subscriptions. As the result, messages disapper from the chat. But not only chat messages disappear. I used this piece of code to understand what’s the cause of the problem, but I can barely understand it. Here’s the most interesting parts from browser console output:
// On page load
send Object {msg: "sub", id: "EPgQwMiDggM7wafCN", name: "chatMessages", params: Array[0]}
receive Object {msg: "added", collection: "chatMessages", id: "G6tv76ZSJYXmnsrAY", fields: Object}
// Calling ‘createArenaRoom’ method
send Object {msg: "method", method: "createArenaRoom", params: Array[1], id: "8", randomSeed: "516b5128615f1c7849f2"}
// User updated
receive Object {msg: "changed", collection: "users", id: "sQnaLPj2FvH692rQM", fields: Object}
// ??? WHY ???
send Object {msg: "unsub", id: "EPgQwMiDggM7wafCN"}
receive Object {msg: "removed", collection: "chatMessages", id: "G6tv76ZSJYXmnsrAY"}
receive Object {msg: "nosub", id: "EPgQwMiDggM7wafCN"}

Any help would be appreciated.


#2

We’ll need to see your subscription and publication code to help.


#3

Thanks for your reply, but the problem is already solved. I described the cause of the problem and the solution on stackoverflow.