fix(core): update

This commit is contained in:
Philipp Kunz 2024-03-27 16:24:57 +01:00
parent 56b8581d2b
commit 765356ce3d
2 changed files with 13 additions and 3 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartdata',
version: '5.0.37',
version: '5.0.38',
description: 'do more with data'
}

View File

@ -37,7 +37,16 @@ export class EasyStore<T> {
this.nameId = nameIdArg;
}
private async getEasyStore() {
private easyStorePromise: Promise<InstanceType<typeof this.easyStoreClass>>;
private async getEasyStore(): Promise<InstanceType<typeof this.easyStoreClass>> {
if (this.easyStorePromise) {
return this.easyStorePromise;
};
// first run from here
const deferred = plugins.smartpromise.defer<InstanceType<typeof this.easyStoreClass>>();
this.easyStorePromise = deferred.promise;
let easyStore = await this.easyStoreClass.getInstance({
nameId: this.nameId,
});
@ -48,7 +57,8 @@ export class EasyStore<T> {
easyStore.data = {};
await easyStore.save();
}
return easyStore;
deferred.resolve(easyStore);
return this.easyStorePromise;
}
/**