mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
Add derive option to clear state after cleanup (#7852)
Co-authored-by: Thomas Rittson <eliykat@users.noreply.github.com>
This commit is contained in:
@@ -48,6 +48,10 @@ type DeriveDefinitionOptions<TFrom, TTo, TDeps extends DerivedStateDependencies
|
||||
* Defaults to 1000ms.
|
||||
*/
|
||||
cleanupDelayMs?: number;
|
||||
/**
|
||||
* Whether or not to clear the derived state when cleanup occurs. Defaults to true.
|
||||
*/
|
||||
clearOnCleanup?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -117,6 +121,10 @@ export class DeriveDefinition<TFrom, TTo, TDeps extends DerivedStateDependencies
|
||||
return this.options.cleanupDelayMs < 0 ? 0 : this.options.cleanupDelayMs ?? 1000;
|
||||
}
|
||||
|
||||
get clearOnCleanup() {
|
||||
return this.options.clearOnCleanup ?? true;
|
||||
}
|
||||
|
||||
buildCacheKey(): string {
|
||||
return `derived_${this.stateDefinition.name}_${this.uniqueDerivationName}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user