Skip to content

Commit 488f197

Browse files
myspiveydavideast
authored andcommitted
docs(database): Changing description of stateChanges() to reflect its proper behavior
* docs(rtdb): Changing description of stateChanges() to reflect its proper behavior. * docs(rtdb): Fixing minor grammar issue from my previous commit. Fixing object doc to reflect changes that occurred in AngularFire2 5.0. Removed references to metadata being added which no longer occurs and reference to preserveSnapshot that was removed. Updated unpacking description to reflect these changes and proper usage. * docs(rtdb): spelled snapshotChanges wrong on previous commit.
1 parent 249c262 commit 488f197

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

docs/rtdb/lists.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ AngularFire provides methods that stream data back as redux compatible actions.
9191
**When would you not use it?** - When you need a more complex data structure than an array or if you need to process changes as they occur. This array is synchronized with the remote and local changes in the Firebase Database.
9292

9393
### `stateChanges()`
94-
**What is it?** - Returns an Observable of the most recent changes as a `AngularFireAction[]`.
94+
**What is it?** - Returns an Observable of the most recent change as an `AngularFireAction`.
9595

96-
**Why would you use it?** - The above methods return a synchronized array sorted in query order. `stateChanges()` emits changes as they occur rather than syncing the query order. This works well for ngrx integrations as you can build your own data structure in your reducer methods.
96+
**Why would you use it?** - The above methods return a singular `AngularFireAction` from each child event that occurs. `stateChanges()` emits changes as they occur rather than syncing the query order. This works well for ngrx integrations as you can build your own data structure in your reducer methods.
9797

9898
**When would you not use it?** - When you just need a list of data. This is a more advanced usage of `AngularFireDatabase`.
9999

docs/rtdb/objects.md

+1-10
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,8 @@ export class AppComponent {
157157
}
158158
```
159159

160-
## Meta-fields on the object
161-
Data retrieved from the object binding contains special properties retrieved from the unwrapped Firebase DataSnapshot.
162-
163-
| property | |
164-
| ---------|--------------------|
165-
| `$key` | The key for each record. This is equivalent to each record's path in our database as it would be returned by `ref.key()`.|
166-
| `$value` | If the data for this child node is a primitive (number, string, or boolean), then the record itself will still be an object. The primitive value will be stored under `$value` and can be changed and saved like any other field.|
167-
168-
169160
## Retrieving the snapshot
170-
AngularFire unwraps the Firebase DataSnapshot by default, but you can get the data as the original snapshot by specifying the `preserveSnapshot` option.
161+
AngularFire `valueChanges()` unwraps the Firebase DataSnapshot by default, but you can get the data as the original snapshot by using the `snapshotChanges()` option instead.
171162

172163
```ts
173164
this.itemRef = db.object('item');

0 commit comments

Comments
 (0)