ddd-react 1.8.0 → 1.9.0

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.
@@ -27,6 +27,7 @@ export declare abstract class Component<P = {}, S = {}, C = null> {
27
27
  didUpdate(prevProps: P, prevState: S): void | Promise<void>;
28
28
  willUnmount(): void | Promise<void>;
29
29
  didUnmount(): void | Promise<void>;
30
+ shouldComponentUpdate(oldProps: P, nextProps: P): boolean;
30
31
  abstract render(): VDOMNode;
31
32
  get elements(): HTMLElement[];
32
33
  get firstElement(): HTMLElement | undefined;
package/dist/index.mjs CHANGED
@@ -453,6 +453,9 @@ class k {
453
453
  didUnmount() {
454
454
  return Promise.resolve();
455
455
  }
456
+ shouldComponentUpdate(t, r) {
457
+ return g(t, r);
458
+ }
456
459
  get elements() {
457
460
  return this.vdom == null ? [] : this.vdom.type === c.FRAGMENT ? v(this.vdom).flatMap((t) => t.type === c.COMPONENT && t.component ? t.component.elements : t.el ? [t.el] : []) : this.vdom.el ? [this.vdom.el] : [];
458
461
  }
@@ -464,9 +467,7 @@ class k {
464
467
  }
465
468
  updateProps(t) {
466
469
  const n = { ...this.getDefaultProps(), ...this.props, ...t }, s = this.props;
467
- this.props = n;
468
- const i = this.updateContext();
469
- g(s, n) && !i || (pt(this) && this.notify(), this.patch(s, this.state));
470
+ this.props = n, !this.shouldComponentUpdate(s, n) && (pt(this) && this.notify(), this.patch(s, this.state));
470
471
  }
471
472
  setState(t) {
472
473
  const r = this.state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-react",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "scripts": {
5
5
  "test": "echo \"Error: no test specified\" && exit 1",
6
6
  "type-check": "tsc --noEmit",