@mantaq/core 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +5 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -383,8 +383,8 @@ var Actor = class {
|
|
|
383
383
|
clock;
|
|
384
384
|
#context;
|
|
385
385
|
#contextHandle;
|
|
386
|
+
#contextWritten = false;
|
|
386
387
|
#lastState;
|
|
387
|
-
#lastContext;
|
|
388
388
|
#options;
|
|
389
389
|
#regions = {};
|
|
390
390
|
#children = /* @__PURE__ */ new Map();
|
|
@@ -435,9 +435,9 @@ var Actor = class {
|
|
|
435
435
|
this.state = initState;
|
|
436
436
|
this.#context = options.context ?? {};
|
|
437
437
|
this.#lastState = initState;
|
|
438
|
-
this.#lastContext = this.#context;
|
|
439
438
|
this.#contextHandle = new Context(() => this.#context, (value) => {
|
|
440
439
|
this.#context = value;
|
|
440
|
+
this.#contextWritten = true;
|
|
441
441
|
});
|
|
442
442
|
this.#subs.seed(this.snapshot());
|
|
443
443
|
if (options.regions) for (const [key, child] of Object.entries(options.regions)) {
|
|
@@ -466,9 +466,9 @@ var Actor = class {
|
|
|
466
466
|
this.#emitChangeIfDirty();
|
|
467
467
|
}
|
|
468
468
|
#emitChangeIfDirty() {
|
|
469
|
-
if (this.state === this.#lastState && this.#
|
|
469
|
+
if (this.state === this.#lastState && !this.#contextWritten) return;
|
|
470
470
|
this.#lastState = this.state;
|
|
471
|
-
this.#
|
|
471
|
+
this.#contextWritten = false;
|
|
472
472
|
this.#subs.emitChange(this.snapshot());
|
|
473
473
|
}
|
|
474
474
|
#dispatch(event) {
|
|
@@ -557,8 +557,7 @@ var Actor = class {
|
|
|
557
557
|
return false;
|
|
558
558
|
}
|
|
559
559
|
count++;
|
|
560
|
-
if (this.#internalIds.has(event.id)) this.#dispatch(event);
|
|
561
|
-
else if (this.#inputIds.has(event.id)) this.#dispatch(event);
|
|
560
|
+
if (this.#internalIds.has(event.id) || this.#inputIds.has(event.id)) this.#dispatch(event);
|
|
562
561
|
else if (this.#outputHandler) this.#outputHandler(event);
|
|
563
562
|
return true;
|
|
564
563
|
});
|