angular-three 1.9.1 → 1.9.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.
@@ -524,13 +524,10 @@ class NgtRxStore extends RxState {
524
524
  this.cache = {};
525
525
  // set a dummy property so that initial this.get() won't return undefined
526
526
  this.set({ __ngt_dummy__: '__ngt_dummy__' });
527
- // call initialize that might be setup by derived Stores
528
- this.initialize();
529
527
  // override set so our consumers don't have to handle undefined for state that already have default values
530
528
  const originalSet = this.set.bind(this);
531
529
  Object.defineProperty(this, 'set', {
532
530
  get: () => {
533
- // Parameters type does not do well with overloads (RxState#set). So we use any[] here
534
531
  return (...args) => {
535
532
  const firstArg = args[0];
536
533
  if (is.obj(firstArg)) {
@@ -540,11 +537,22 @@ class NgtRxStore extends RxState {
540
537
  }, {});
541
538
  return originalSet(modArgs);
542
539
  }
543
- // @ts-expect-error not sure why ...args here doesn't pass tuple check
544
540
  return originalSet(...args);
545
541
  };
546
542
  },
547
543
  });
544
+ // override get to return {} if get() returns undefined
545
+ const originalGet = this.get.bind(this);
546
+ Object.defineProperty(this, 'get', {
547
+ get: () => {
548
+ return (...args) => {
549
+ const state = originalGet(...args);
550
+ return state || {};
551
+ };
552
+ },
553
+ });
554
+ // call initialize that might be setup by derived Stores
555
+ this.initialize();
548
556
  }
549
557
  initialize() {
550
558
  return;
@@ -2138,11 +2146,12 @@ class NgtRenderer {
2138
2146
  this.appendChild(val, newChild);
2139
2147
  }
2140
2148
  });
2149
+ return;
2141
2150
  }
2142
2151
  else if (parent !== cRS[2 /* NgtRendererClassId.injectedParent */]) {
2143
2152
  this.appendChild(cRS[2 /* NgtRendererClassId.injectedParent */], newChild);
2153
+ return;
2144
2154
  }
2145
- return;
2146
2155
  }
2147
2156
  this.store.setParent(newChild, parent);
2148
2157
  this.store.addChild(parent, newChild);