FirebaseExtended / FirebaseExtended/rxfire

CollectionData() returning incorrect value first until it return expected data

Open
#105 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
149
Forks
50
PR merge metrics
No merged PRs in 30d

Description

When using collectionData(), it always returns the latest entry first, then returns the actual values on the second emit. Say we have the following expected data:
```
Entry-1 ---> latest
Entry-2
Entry-3
Entry-4
```

With the following code:
```
collectionData(query, opt).pipe(
tap(cs => {
console.log("firebase returns :", cs)
}),
);
```
We will get two logs:
```
-> [Entry-1]
-> [Entry-1, Entry-2, Entry-3, Entry-4]
```

Ideally, we would want only 1 emit with all the data so views don't break(like scroll bar resets due to length of array changes) Any ideas on why this is happening and if there is a way/option we can prevent the first single emit from happening?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.