fix(core): update

This commit is contained in:
2023-04-04 21:44:16 +02:00
parent fad7e0bc6b
commit b6b738916f
5 changed files with 30 additions and 38 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartstate',
version: '2.0.2',
version: '2.0.3',
description: 'a package that handles state in a good way'
}

View File

@ -34,7 +34,11 @@ export class StatePart<TStatePartName, TStatePayload> {
const createStateHash = (stateArg: any) => {
return plugins.isohash.sha256FromString(plugins.smartjson.stringify(stateArg));
};
if (this.stateStore && this.lastStateNotificationPayloadHash && createStateHash(this.stateStore) === createStateHash(this.lastStateNotificationPayloadHash)) {
if (
this.stateStore &&
this.lastStateNotificationPayloadHash &&
createStateHash(this.stateStore) === createStateHash(this.lastStateNotificationPayloadHash)
) {
return;
} else {
this.lastStateNotificationPayloadHash = this.stateStore;
@ -105,9 +109,11 @@ export class StatePart<TStatePartName, TStatePayload> {
}
/**
* is executed
* is executed
*/
public stateSetup(funcArg: (statePartArg?: StatePart<any, TStatePayload>) => Promise<TStatePayload | void>) {
public stateSetup(
funcArg: (statePartArg?: StatePart<any, TStatePayload>) => Promise<TStatePayload | void>
) {
this.cumulativeDeferred.addPromise(funcArg(this));
}
}