From c4b214a308311e8e656dccdfeb2225aab479fa8a Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Thu, 13 Apr 2023 14:22:31 +0200 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/smartstate.classes.statepart.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 998ff57..256aae8 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartstate', - version: '2.0.5', + version: '2.0.6', description: 'a package that handles state in a good way' } diff --git a/ts/smartstate.classes.statepart.ts b/ts/smartstate.classes.statepart.ts index b227ac4..d579872 100644 --- a/ts/smartstate.classes.statepart.ts +++ b/ts/smartstate.classes.statepart.ts @@ -37,7 +37,7 @@ export class StatePart { if ( this.stateStore && this.lastStateNotificationPayloadHash && - createStateHash(this.stateStore) === createStateHash(this.lastStateNotificationPayloadHash) + createStateHash(this.stateStore) === this.lastStateNotificationPayloadHash ) { return; } else { @@ -47,6 +47,14 @@ export class StatePart { } private lastStateNotificationPayloadHash: any; + /** + * creates a cumulative notification by adding a change notification at the end of the call stack; + */ + public notifyChangeCumulative() { + // TODO: check viability + setTimeout(() => this.state.next(this.stateStore), 0); + } + /** * selects a state or a substate */ @@ -56,7 +64,6 @@ export class StatePart { if (!selectorFn) { selectorFn = (state: TStatePayload) => (state); } - const mapped = this.state.pipe( plugins.smartrx.rxjs.ops.startWith(this.getState()), plugins.smartrx.rxjs.ops.map((stateArg) => { @@ -67,7 +74,6 @@ export class StatePart { } }) ); - return mapped; }