mirror of
https://github.com/bitwarden/browser
synced 2025-12-23 03:33:54 +00:00
[PM-16791] introduce generator profile provider (#13588)
This commit is contained in:
@@ -12,6 +12,7 @@ export abstract class UserStateSubjectDependencyProvider {
|
||||
/** Provides local object persistence */
|
||||
abstract state: StateProvider;
|
||||
|
||||
// FIXME: remove `log` and inject the system provider into the USS instead
|
||||
/** Provides semantic logging */
|
||||
abstract log: <Context extends object>(_context: Jsonify<Context>) => SemanticLogger;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ const DEFAULT_FRAME_SIZE = 32;
|
||||
export class UserStateSubject<
|
||||
State extends object,
|
||||
Secret = State,
|
||||
Disclosed = never,
|
||||
Disclosed = Record<string, never>,
|
||||
Dependencies = null,
|
||||
>
|
||||
extends Observable<State>
|
||||
@@ -243,7 +243,7 @@ export class UserStateSubject<
|
||||
// `init$` becomes the accumulator for `scan`
|
||||
init$.pipe(
|
||||
first(),
|
||||
map((init) => [init, null] as const),
|
||||
map((init) => [init, null] as [State, Dependencies]),
|
||||
),
|
||||
input$.pipe(
|
||||
map((constrained) => constrained.state),
|
||||
@@ -256,7 +256,7 @@ export class UserStateSubject<
|
||||
if (shouldUpdate) {
|
||||
// actual update
|
||||
const next = this.context.nextValue?.(prev, pending, dependencies) ?? pending;
|
||||
return [next, dependencies];
|
||||
return [next, dependencies] as const;
|
||||
} else {
|
||||
// false update
|
||||
this.log.debug("shouldUpdate prevented write");
|
||||
|
||||
Reference in New Issue
Block a user