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

Fixing null set with RTDB and more #1264

Merged
merged 22 commits into from
Oct 13, 2017

Conversation

jamesdaniels
Copy link
Member

@jamesdaniels jamesdaniels commented Oct 13, 2017

Checklist

Description

Working on closing out some of the issues and cleaning up the code with the 5.0 of the RTDB Service.

  • Once now closes out the subscription
  • Handle multiple subscriptions to the AngularFireDatabase
  • Empty set should return null
  • Better batching of first load, using once (needed step to support Universal)
  • Handle ordered child_added events
  • Don't error out on unsubscribe of a once
  • Clean up the tests to use take(...) and add(...)
  • Cleaning up the types

TODOS:

  • Clean up the code some more
  • Figure out why I needed to go online for some of the tests, reduce that as much as possible
  • Test sorting some more

Code sample

let items = [...];
let count = 0;
db.list('items').snapshotChanges().subscribe(snapshots => console.log(count += 1, snapshots));
await ref.set(items);
await ref.push({ name: '...' });
await ref.child(items[0].key).update({ name: '...'});
await ref.child(items[1].key).remove()
await ref.child(items[0].key).setPriority('...');
LOG: 1, [Object{payload: ..., type: 'value', prevKey: undefined, key: '0'}, Object{payload: ..., type: 'value', prevKey: undefined, key: '1'}, Object{payload: ..., type: 'value', prevKey: undefined, key: '2'}]
LOG: 2, [Object{payload: ..., type: 'value', prevKey: undefined, key: '0'}, Object{payload: ..., type: 'value', prevKey: undefined, key: '1'}, Object{payload: ..., type: 'value', prevKey: undefined, key: '2'}, Object{type: 'child_added', payload: ..., prevKey: '2', key: '-KwM4ThL2evnTjT-KHhV'}]
LOG: 3, [Object{type: 'child_changed', payload: ..., prevKey: null, key: '0}, Object{payload: ..., type: 'value', prevKey: undefined, key: '1'}, Object{payload: ..., type: 'value', prevKey: undefined, key: '2'}, Object{type: 'child_added', payload: ..., prevKey: '2', key: '-KwM4ThL2evnTjT-KHhV}]
LOG: 4, [Object{type: 'child_changed', payload: ..., prevKey: null, key: '0'}, Object{payload: ..., type: 'value', prevKey: undefined, key: '2'}, Object{type: 'child_added', payload: ..., prevKey: '2', key: '-KwM4ThL2evnTjT-KHhV'}]
LOG: 5, [Object{payload: ..., type: 'value', prevKey: undefined, key: '2'}, Object{type: 'child_added', payload: ..., prevKey: '2', key: '-KwM4ThL2evnTjT-KHhV'}, Object{type: 'child_changed', payload: ..., prevKey: null, key: '0'}]
LOG: 6, [Object{payload: ..., type: 'value', prevKey: undefined, key: '2'}, Object{type: 'child_added', payload: ..., prevKey: '2', key: '-KwM4ThL2evnTjT-KHhV'}, Object{type: 'child_changed', payload: ..., prevKey: '-KwM4ThL2evnTjT-KHhV', key: '0'}]

@jamesdaniels jamesdaniels changed the title WIP fixing null set with RTDB and more Fixing null set with RTDB and more Oct 13, 2017
@jamesdaniels jamesdaniels merged commit eda1c41 into angular:master Oct 13, 2017
@jamesdaniels jamesdaniels deleted the wip_fixing_null_set branch October 13, 2017 23:37
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.

2 participants