Skip to content

Fixing null set with RTDB and more - #1264

Merged
jamesdaniels merged 22 commits into
angular:masterfrom
jamesdaniels:wip_fixing_null_set
Oct 13, 2017
Merged

jamesdaniels merged 22 commits into
angular:masterfrom
jamesdaniels:wip_fixing_null_set

Conversation

@jamesdaniels

@jamesdaniels jamesdaniels commented Oct 13, 2017 •

Copy link
Copy Markdown
Contributor

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