Skip to content

ValueChanges not returning all data. #1747

@robert-king

Description

@robert-king

Version info

"@agm/core": "^1.0.0-beta.2",
"@angular/animations": "6.0.5",
"@angular/cdk": "^5.2.5",
"@angular/common": "6.0.5",
"@angular/compiler": "6.0.5",
"@angular/core": "6.0.5",
"@angular/forms": "6.0.5",
"@angular/http": "6.0.5",
"@angular/material": "^5.2.5",
"@angular/platform-browser": "6.0.5",
"@angular/platform-browser-dynamic": "6.0.5",
"@angular/router": "6.0.5",
"@angular/service-worker": "6.0.5",
"angular-instantsearch": "^2.0.2",
"angularfire2": "^5.0.0-rc.10",

return this.usersCollection.valueChanges().subscribe((users) => {
  console.log('got users', users);
})

I have two users, however it logs a users array of just one user, then after that, it logs an array with two users. This is dangerous because If I pipe valueChanges() to first() or take(1), then I will be missing content forever.

I assume this happens because one of the users is me, and since i've already logged in, my user record is in the cache, so it returns that while fetching the rest of the user collection. Perhaps that's expected behaviour, if so, then it should be better documented to be careful piping valueChanges to .first() or to .take(1)

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