1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Revert breaking change

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2022-01-10 15:10:53 +02:00
parent eeff7e488f
commit ae1d3a2712
No known key found for this signature in database
GPG Key ID: 5F465B5672372402

View File

@ -74,6 +74,11 @@ export class StorageHelper<T> {
this.storage = storage;
// TODO: This code uses undocumented MobX internal to criminally permit exotic mutations without encapsulation.
this.data.observe_(({ newValue, oldValue }) => {
this.onChange(newValue as T, oldValue as T);
});
if (autoInit) {
this.init();
}
@ -133,6 +138,7 @@ export class StorageHelper<T> {
}
}
// @deprecated: Switch to using value for being reactive
get(): T {
return this.value;
}
@ -143,16 +149,12 @@ export class StorageHelper<T> {
}
@action
set(newValue: T) {
const oldValue = this.value;
if (this.isDefaultValue(newValue)) {
set(value: T) {
if (this.isDefaultValue(value)) {
this.reset();
} else {
this.data.set(newValue);
this.data.set(value);
}
this.onChange(newValue, oldValue);
}
@action