Skip to content

docs(database): fix objectVal/listVal docs and multiple instances example - #3857

Open
AdamBoczula wants to merge 1 commit into
angular:mainfrom
AdamBoczula:docs/fix-database-docs
Open

AdamBoczula wants to merge 1 commit into
angular:mainfrom
AdamBoczula:docs/fix-database-docs

Conversation

@AdamBoczula

Copy link
Copy Markdown

Checklist

  • Issue number for this PR: none
  • Docs included?: yes (docs only)
  • Test units included?: no (docs only)
  • Breaking change?: no
  • In a clean directory, yarn install, yarn test run successfully? not run (Markdown only)

Description

Fixes several inaccuracies in docs/database.md:

  • Swapped objectVal() and listVal() descriptions: objectVal() emits the value of a single node (Observable<T>), while listVal() emits an array of child values (Observable<T[]>). Also fixes listVal()'s parameter name (ref -> query) and return type (Observable<T | null> -> Observable<T[]>).
  • Modular SDK types: replaces the v8 Reference type with DatabaseReference in the convenience observable tables (object, objectVal, list, listVal, stateChanges, auditTrail, fromRef), and aligns the Markdown tables.
  • Typo: fixes options:? -> options?: in the stateChanges table.
  • Multiple instances example: updates provideDatabase((app: FirebaseApp) => getDatabase(app, ...)) to provideDatabase(() => getDatabase(inject(FirebaseApp), ...)), since provideDatabase takes (injector: Injector) => FirebaseDatabase rather than FirebaseApp.

Verification

Checked directly against the source signatures:

  • src/database/database.module.ts: provideDatabase(fn: (injector: Injector) => FirebaseDatabase, ...deps: any[])
  • src/database/firebase.ts / firebase/database: DatabaseReference extends Query
  • rxfire (database/object/index.ts and database/list/index.ts): objectVal<T>(query: Query, options?: { keyField?: string }): Observable<T> and listVal<T>(query: Query, options?: { keyField?: string }): Observable<T[]>
…mple

- Swap the reversed descriptions of objectVal() and listVal(), and fix listVal() return type (Observable<T[]>) and parameter name (query)
- Update Reference to DatabaseReference in the convenience observable tables
- Fix options:? typo in the stateChanges table
- Use inject(FirebaseApp) in provideDatabase() in the Working with multiple instances example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant