reactronic 0.24.121 → 0.24.123

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.
@@ -46,6 +46,7 @@ export declare abstract class RxNode<E = unknown> {
46
46
  static set childrenShuffling(value: boolean);
47
47
  static triggerUpdate(node: RxNode<any>, triggers: unknown): void;
48
48
  static updateNestedNodesThenDo(action: (error: unknown) => void): void;
49
+ static markAsMounted(node: RxNode<any>, yes: boolean): void;
49
50
  static findMatchingHost<E = unknown, R = unknown>(node: RxNode<E>, match: SimpleDelegate<RxNode<E>, boolean>): RxNode<R> | undefined;
50
51
  static findMatchingPrevSibling<E = unknown, R = unknown>(node: RxNode<E>, match: SimpleDelegate<RxNode<E>, boolean>): RxNode<R> | undefined;
51
52
  static forEachChildRecursively<E = unknown>(node: RxNode<E>, action: SimpleDelegate<RxNode<E>>): void;
@@ -109,6 +109,14 @@ export class RxNode {
109
109
  static updateNestedNodesThenDo(action) {
110
110
  runUpdateNestedNodesThenDo(undefined, action);
111
111
  }
112
+ static markAsMounted(node, yes) {
113
+ const n = node;
114
+ if (n.stamp < 0)
115
+ throw new Error('finalized node cannot be mounted or unmounted');
116
+ if (n.stamp >= Number.MAX_SAFE_INTEGER)
117
+ throw new Error('node must be initialized before mounting');
118
+ n.stamp = yes ? 0 : Number.MAX_SAFE_INTEGER - 1;
119
+ }
112
120
  static findMatchingHost(node, match) {
113
121
  let p = node.host;
114
122
  while (p !== p.host && !match(p))
@@ -451,15 +459,14 @@ function triggerUpdateViaSeat(seat) {
451
459
  function mountOrRemountIfNecessary(node) {
452
460
  const driver = node.driver;
453
461
  if (node.stamp === Number.MAX_SAFE_INTEGER) {
454
- node.stamp = Number.MAX_SAFE_INTEGER - 1;
455
462
  unobs(() => {
463
+ node.stamp = Number.MAX_SAFE_INTEGER - 1;
456
464
  driver.initialize(node);
457
465
  if (!node.has(Mode.ManualMount)) {
458
466
  node.stamp = 0;
459
467
  if (node.host !== node)
460
468
  driver.mount(node);
461
469
  }
462
- node.stamp = 0;
463
470
  });
464
471
  }
465
472
  else if (node.isMoved && !node.has(Mode.ManualMount) && node.host !== node)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.24.121",
3
+ "version": "0.24.123",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",