Skip to content

FirebaseListObservables retrieve the initial list content twice #819

@cartant

Description

@cartant

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions