angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

FirebaseListObservable emits duplicate values for first insert

Open jteplitz opened this issue 10 years ago • 23 comments

If I subscribe to an empty list, and then add a new value to that list it looks like that value is getting emitted twice. For example if I do:

let observable = this._angularFire.list('my_path', {preserveSnapshot: true});
observable.subscribe ((l) => {
  console.log('length', l.length);
});
setTimeout(() => {
  observable.add({text: 'new'});
}, 1);

If 'my_path' is initially empty this will output: length 1 length 2

The 2 is erroneous and contains a duplicate entry.

It doesn't look like this problem occurs if 'my_path' is not initially empty.

jteplitz avatar Mar 08 '16 19:03 jteplitz

@davideast There is a serious data duplication problem with database lists. Updates to the list produce duplicates, initial loading of lists produce duplicates, .map and .subscribe produce duplicates. Have you taken a look at this all? This is incredibly frustrating. It seemingly happens at random all over my app.

ealmiladi avatar May 22 '17 06:05 ealmiladi

@davideast Is there any word on this? I'm having this problem as well.

zaki-arain avatar Jun 07 '17 22:06 zaki-arain

@zaki-arain If you're running into this issue then please create a plnkr replicating it and then open a new issue. We'll be happy to debug :)

Note: The above goes for anyone who runs into this issue.

davideast avatar Jun 07 '17 22:06 davideast