googlearchive / firebase-util

An experimental toolset for Firebase
http://firebase.github.io/firebase-util
MIT License
276 stars 67 forks source link

Removing a node of the normalized collection throws exception #72

Closed blommish closed 8 years ago

blommish commented 8 years ago

The following code is almost a copy of the one generated on the firebase-util site. The problem occurs when I delete one of the nodes in channels in the firebase dashboard, or deleting it by taking channels..child('/child').remove(), it throws the following error.

var channels = baseRef.child("/channels");
var ref = new Firebase.util.NormalizedCollection(
  [channels, "channel"],
  [baseRef.child("/users"), "user", "channel.createdBy"]
  )
.select(
  "channel.createdBy",
  {"key":"channel.name","alias":"channelName"},
  "user.name"
  )
.ref();

Removing:-K03G79hknJW_f7TjPEy FIREBASE WARNING: Exception was thrown by user callback. TypeError: Cannot read property 'ref' of null at Object.i.update (http://localhost:9000/bower_components/firebase-util/dist/firebase->util.min.js:9:22050) at http://localhost:9000/bower_components/firebase-util/dist/firebase-util.min.js:9:18061 at h.Ub (http://localhost:9000/bower_components/firebase/firebase.js:49:642) at Cb (http://localhost:9000/bower_components/firebase/firebase.js:46:165) at yb (http://localhost:9000/bower_components/firebase/firebase.js:22:216) at zb (http://localhost:9000/bower_components/firebase/firebase.js:21:1259) at Ih.h.Jb (http://localhost:9000/bower_components/firebase/firebase.js:203:440) at U.set (http://localhost:9000/bower_components/firebase/firebase.js:243:165) at U.remove (http://localhost:9000/bower_components/firebase/firebase.js:246:139) at Scope.$scope.removeChannel (http://localhost:9000/app/routes/admin/adminCtrl.js:52:39) firebase.js:46 Uncaught TypeError: Cannot read property 'ref' of null

katowulf commented 8 years ago

Thanks for taking the time to submit this. If I could borrow just a bit more of your time, can you generate a minimal repro that we can use to see this problem happen? Also, seeing the stack trace against the non-minified version would go a long way here. Cheers.

blommish commented 8 years ago

Hmm, made a jsfiddle similar to my case but it does not throw any exception. https://jsfiddle.net/1avmt71y/

So either you close the issue, and I investigate some further. Or you keep it open for a while.

katowulf commented 8 years ago

For simplicity, let's close it. If you get a repro, post it here and let's reopen. Feel free to post any questions, clues, or comments you have as you work on it; glad to help.

laurensnl commented 8 years ago

@blommish did you find a solution for your problem? I am running into the same issue here.

blommish commented 8 years ago

@laurensnl I did not find any solution and due to some other limitations I decided to use the firebase library, even without angular library