Skip to content

Commit

Permalink
refactor: Rename update method to replaceData in DocumentReference
Browse files Browse the repository at this point in the history
This commit renames the `update` method to `replaceData` in the `DocumentReference` class. The purpose of this change is to provide a more descriptive and accurate method name that reflects the behavior of replacing the entire data object with a new one. This change aligns with the recent refactoring of other methods in the `DocumentReference` class, such as `updatePartial` to `mergeItemData`, `remove` to `removeItem`, `append` to `appendItem`, `add` to `addItem`, `getItem` to `getItemData`, and `exists` to `itemExists`. The renaming of methods improves code readability and consistency.

BREAKING CHANGE: The `update` method has been replaced with `replaceData` in the `DocumentReference` class. Developers should update their code to use the new method name.
  • Loading branch information
alimd committed Sep 2, 2024
1 parent b7108c7 commit 367257c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/reference/src/document-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ export class DocumentReference<TDoc extends JsonifiableObject = JsonifiableObjec
*
* @example
* ```typescript
* documentRef.update({ a: 1, b: 2, c: 3 });
* documentRef.overwriteData({ a: 1, b: 2, c: 3 });
* ```
*/
update(data: TDoc): void {
this.logger__.logMethodArgs?.('update', data);
replaceData(data: TDoc): void {
this.logger__.logMethodArgs?.('overwriteData', data);
(this.context__.data as unknown) = data;
this.updated__();
}
Expand Down

0 comments on commit 367257c

Please sign in to comment.