mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Fix SingleUserStateProvider (#7593)
* Fix SingleUserStateProvider - Fix cache key to be unique per instance per user * Add Specific State Provider Tests * Add Missing await
This commit is contained in:
@@ -148,11 +148,13 @@ export class KeyDefinition<T> {
|
||||
*/
|
||||
buildCacheKey(scope: "user" | "global", userId?: "active" | UserId): string {
|
||||
if (scope === "user" && userId == null) {
|
||||
throw new Error("You must provide a userId when building a user scoped cache key.");
|
||||
throw new Error(
|
||||
"You must provide a userId or 'active' when building a user scoped cache key.",
|
||||
);
|
||||
}
|
||||
return userId === null
|
||||
? `${this.stateDefinition.storageLocation}_${scope}_${userId}_${this.stateDefinition.name}_${this.key}`
|
||||
: `${this.stateDefinition.storageLocation}_${scope}_${this.stateDefinition.name}_${this.key}`;
|
||||
? `${this.stateDefinition.storageLocation}_${scope}_${this.stateDefinition.name}_${this.key}`
|
||||
: `${this.stateDefinition.storageLocation}_${scope}_${userId}_${this.stateDefinition.name}_${this.key}`;
|
||||
}
|
||||
|
||||
private get errorKeyName() {
|
||||
|
||||
Reference in New Issue
Block a user