Skip to content

fix(afs): Don't filter empty changes (allow for null set), closes #1184 #1186

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

Merged
merged 2 commits into from
Oct 5, 2017

Conversation

jamesdaniels
Copy link
Member

Checklist

  • Issue number for this PR: Allow for empty sets in AFS #1184
  • Docs included?: n/a
  • Test units included?: yes
  • In a clean directory, npm install, npm run build, and npm test run successfully? yes

Description

Per #1184 AFS is filtering empty sets from valueChanges(), this has been fixed.

Copy link
Collaborator

@davideast davideast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another great PR, @jamesdaniels! I think we just need one more test that I described in the review. After that we should be good to go!

const ref = afs.firestore.collection(`${randomCollectionName}`);
let names = await createRandomStocks(afs.firestore, ref, ITEMS);
const sub = pricefilter$.switchMap(price => {
return afs.collection(randomCollectionName, ref => price ? ref.where('price', '==', price) : ref).valueChanges()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to test multiple events: ['added', 'modified']. That way we can make sure we're not breaking anything with removing the .filter() in sortedChanges(). Ideally you would write a test that limits to two events and tests the proper emission of each event.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jamesdaniels
Copy link
Member Author

@davideast done.

@davideast davideast merged commit f2df83e into master Oct 5, 2017
@davideast davideast deleted the allow_empty_changes branch October 5, 2017 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants