Skip to content

Commit fbd3861

Browse files
committed
Addressed PR feedback.
1 parent 354c62d commit fbd3861

File tree

1 file changed

+9
-2
lines changed
  • docs/architecture/deep-dives/state

1 file changed

+9
-2
lines changed

docs/architecture/deep-dives/state/index.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class DomainService {
185185
}
186186

187187
async clearStateValue(userId: UserId): Promise<void> {
188-
await this.stateProvider.getUserState$(userId, DOMAIN_USER_STATE).update((state) => null);
188+
await this.stateProvider.getUser(userId, DOMAIN_USER_STATE).update((state) => null);
189189
}
190190
}
191191
```
@@ -263,7 +263,14 @@ that the update has taken place before the `firstValueFrom()` executes, in which
263263
(cached) value of the observable will be returned.
264264
265265
Use of `firstValueFrom()` should be avoided. If you find yourself trying to use `firstValueFrom()`,
266-
consider propagating the underlying observable instead of leaving reactivity. :::
266+
consider propagating the underlying observable instead of leaving reactivity.
267+
268+
If you do need to obtain the result of an update in a non-reactive way, you should use the result
269+
returned from the `update()` method. This should be used instead of immediately re-requesting the
270+
value through `firstValueFrom()`. The `update()` will return the value that will be persisted to
271+
state, after any `shouldUpdate()` filters are applied.
272+
273+
:::
267274
268275
#### Using `shouldUpdate` to filter unnecessary updates
269276

0 commit comments

Comments
 (0)