Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FirebaseListObservables retrieve the initial list content twice #819

Closed
cartant opened this issue Feb 10, 2017 · 1 comment · Fixed by #826
Closed

FirebaseListObservables retrieve the initial list content twice #819

cartant opened this issue Feb 10, 2017 · 1 comment · Fixed by #826

Comments

@cartant
Copy link
Contributor

cartant commented Feb 10, 2017

Version info

Angular: 2.4.7
Firebase: 3.6.9
AngularFire: 2.0.0-beta.7
Other (e.g. Ionic/Cordova, Node, browser, operating system): N/A

How to reproduce these conditions

Failing test unit, Plunkr, or JSFiddle demonstrating the problem

There is a plunk here.

Steps to set up and reproduce

Open the above plunk and then:

  • Open the Dev Tools and go to the Network tab.
  • Select WS or All to observe the WebSocket traffic.
  • Run the plunk.
  • There will be an entry of about 7557 bytes which is the initial content written to the database.
  • That entry will be followed by two of about 7550 bytes and those entries are the content thats read from the database.

The problem is caused by on('child_added', ...) not being called until after the on('value') promise has resolved.

Expected behavior

When subscribing to a FirebaseListObservable that has content that exists in the database, a single copy of the content should be retrieved across the network.

Actual behavior

Two copies of the content are retrieved across the network.

cartant added a commit to cartant/angularfire that referenced this issue Feb 10, 2017
davideast pushed a commit that referenced this issue Feb 15, 2017
* fix(database): retrieve initial list content once

Closes #819

* test(database): add a child_added quirk test
@alixaxel
Copy link

@davideast @cartant I noticed this is still happening with the latest release 5.0.0-rc.11.

Here's a StackBlitz demonstrating the same behavior: https://stackblitz.com/edit/angular-rxjs6-f2ey8o

image

Is this a regression?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants