Prefer UserKeyDefinition for user-scoped data (#9349)

This commit is contained in:
Matt Gibson 2024-05-27 08:12:53 -04:00 committed by GitHub
parent c61ba41b97
commit 2e6280ce88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -1,23 +1,25 @@
import { Jsonify } from "type-fest";
import { BROWSER_SEND_MEMORY, KeyDefinition } from "@bitwarden/common/platform/state";
import { BROWSER_SEND_MEMORY, UserKeyDefinition } from "@bitwarden/common/platform/state";
import { BrowserComponentState } from "../../../models/browserComponentState";
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
export const BROWSER_SEND_COMPONENT = new KeyDefinition<BrowserSendComponentState>(
export const BROWSER_SEND_COMPONENT = new UserKeyDefinition<BrowserSendComponentState>(
BROWSER_SEND_MEMORY,
"browser_send_component",
{
deserializer: (obj: Jsonify<BrowserSendComponentState>) =>
BrowserSendComponentState.fromJSON(obj),
clearOn: ["logout", "lock"],
},
);
export const BROWSER_SEND_TYPE_COMPONENT = new KeyDefinition<BrowserComponentState>(
export const BROWSER_SEND_TYPE_COMPONENT = new UserKeyDefinition<BrowserComponentState>(
BROWSER_SEND_MEMORY,
"browser_send_type_component",
{
deserializer: (obj: Jsonify<BrowserComponentState>) => BrowserComponentState.fromJSON(obj),
clearOn: ["logout", "lock"],
},
);