{"action":"created","issue":{"url":"https://api.github.com/repos/katowulf/mockfirebase/issues/78","labels_url":"https://api.github.com/repos/katowulf/mockfirebase/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/katowulf/mockfirebase/issues/78/comments","events_url":"https://api.github.com/repos/katowulf/mockfirebase/issues/78/events","html_url":"https://github.com/katowulf/mockfirebase/issues/78","id":60793819,"number":78,"title":"Infinite loop when setting keys in .transaction()'s onComplete-function","user":{"login":"msiebuhr","id":330611,"avatar_url":"https://avatars.githubusercontent.com/u/330611?v=3","gravatar_id":"","url":"https://api.github.com/users/msiebuhr","html_url":"https://github.com/msiebuhr","followers_url":"https://api.github.com/users/msiebuhr/followers","following_url":"https://api.github.com/users/msiebuhr/following{/other_user}","gists_url":"https://api.github.com/users/msiebuhr/gists{/gist_id}","starred_url":"https://api.github.com/users/msiebuhr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msiebuhr/subscriptions","organizations_url":"https://api.github.com/users/msiebuhr/orgs","repos_url":"https://api.github.com/users/msiebuhr/repos","events_url":"https://api.github.com/users/msiebuhr/events{/privacy}","received_events_url":"https://api.github.com/users/msiebuhr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-12T09:50:41Z","updated_at":"2015-03-12T11:00:27Z","closed_at":"2015-03-12T11:00:27Z","body":"I have an app where I do a transaction and then proceed to update some keys in another end of the database to match (I know; foreign keys in a document store).\r\n\r\nThe code below works on a real Firebase, but enters an infinite loop where `this._defer(...)` inside `MockFirebase.transaction()` is called infinitely when using `mockfirebase`:\r\n\r\n    var mockFirebase = new (require('mockfirebase').MockFirebase)();\r\n    mockFirebase.child('rooms/roomid').transaction(function (cur) {\r\n        return undefined; // Return whatever - an actual value cause same result\r\n    }, function (err, committed, snapshot) {\r\n        var k = snapshot.key();\r\n        // Commenting out this write removes infinite loop\r\n        mockFirebase.child('users/userid/roomId').set(k, function () {\r\n            done();\r\n        });\r\n    });\r\n\r\n(Adding `console.log('MF.transaction._defer', (new Error()).stack);` just inside the deferred function shows stack ending in the queue-logic somewhere)."},"comment":{"url":"https://api.github.com/repos/katowulf/mockfirebase/issues/comments/78459748","html_url":"https://github.com/katowulf/mockfirebase/issues/78#issuecomment-78459748","issue_url":"https://api.github.com/repos/katowulf/mockfirebase/issues/78","id":78459748,"user":{"login":"bendrucker","id":808808,"avatar_url":"https://avatars.githubusercontent.com/u/808808?v=3","gravatar_id":"","url":"https://api.github.com/users/bendrucker","html_url":"https://github.com/bendrucker","followers_url":"https://api.github.com/users/bendrucker/followers","following_url":"https://api.github.com/users/bendrucker/following{/other_user}","gists_url":"https://api.github.com/users/bendrucker/gists{/gist_id}","starred_url":"https://api.github.com/users/bendrucker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bendrucker/subscriptions","organizations_url":"https://api.github.com/users/bendrucker/orgs","repos_url":"https://api.github.com/users/bendrucker/repos","events_url":"https://api.github.com/users/bendrucker/events{/privacy}","received_events_url":"https://api.github.com/users/bendrucker/received_events","type":"User","site_admin":false},"created_at":"2015-03-12T11:00:27Z","updated_at":"2015-03-12T11:00:27Z","body":"0.10.3 is on its way up now"}}