File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
docs/architecture/deep-dives/state Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ class DomainService {
185
185
}
186
186
187
187
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 );
189
189
}
190
190
}
191
191
```
@@ -263,7 +263,14 @@ that the update has taken place before the `firstValueFrom()` executes, in which
263
263
(cached) value of the observable will be returned.
264
264
265
265
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
+ :::
267
274
268
275
#### Using ` shouldUpdate ` to filter unnecessary updates
269
276
You can’t perform that action at this time.
0 commit comments