rask-ui 0.28.1 → 0.28.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.
@@ -11,6 +11,7 @@ export declare class RaskComponent<P extends Props<any>> extends Component<P> {
11
11
  private reactiveProps;
12
12
  private isNotified;
13
13
  private isReconciling;
14
+ private hasChangedComponent;
14
15
  observer: Observer;
15
16
  isRendering: boolean;
16
17
  effects: Array<{
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAsB,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAMrE,wBAAgB,mBAAmB,mCAElC;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,IAAI,QAM5C;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,IAAI,QAMxC;AAED,MAAM,MAAM,8BAA8B,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,IAC3D,CAAC,MAAM,KAAK,CAAC,GACb,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC;AAE1B,MAAM,MAAM,6BAA6B,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,IAC1D,CAAC,MAAM,MAAM,KAAK,CAAC,GACnB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,KAAK,CAAC,CAAC;AAEhC,qBAAa,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC3D,QAAQ,EAAE,8BAA8B,CAAC,CAAC,CAAC,CAAC;IACpD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAC1C,OAAO,CAAC,aAAa,CAAc;IAwBnC,OA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,GACnB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,KAAK,CAAC,CAAC;AAEhC,qBAAa,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC3D,QAAQ,EAAE,8BAA8B,CAAC,CAAC,CAAC,CAAC;IACpD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAC1C,OAAO,CAAC,aAAa,CAAc;IAwBnC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,mBAAmB,CAAQ;IAEnC,QAAQ,WAOL;IAEH,WAAW,UAAS;IACpB,OAAO,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAM;IAC3D,QAAQ,gBAAa;IACrB,UAAU,CAAC,OAAO,EAAE,OAAO;IAS3B,eAAe;IAMf,QAAQ,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAM;IACjC,UAAU,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAM;IAEnC,iBAAiB,IAAI,IAAI;IAGzB,oBAAoB,IAAI,IAAI;IAI5B,yBAAyB,CACvB,SAAS,EAAE,QAAQ,CAAC;QAAE,QAAQ,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,CAAC,CAAC,GAClD,IAAI;IAgBP,qBAAqB,IAAI,OAAO;IAMhC,MAAM;CAkDP"}
package/dist/component.js CHANGED
@@ -45,6 +45,7 @@ export class RaskComponent extends Component {
45
45
  // calling forceUpdate() at the wrong time during Inferno's reconciliation.
46
46
  isNotified = false;
47
47
  isReconciling = false;
48
+ hasChangedComponent = true;
48
49
  observer = new Observer(() => {
49
50
  if (this.isReconciling) {
50
51
  this.isNotified = true;
@@ -81,6 +82,8 @@ export class RaskComponent extends Component {
81
82
  this.isReconciling = true;
82
83
  const prevProps = this.props;
83
84
  this.props = nextProps;
85
+ this.hasChangedComponent =
86
+ prevProps.__component !== this.props.__component;
84
87
  syncBatch(() => {
85
88
  for (const prop in this.propsSignals) {
86
89
  if (prevProps[prop] === nextProps[prop]) {
@@ -91,7 +94,7 @@ export class RaskComponent extends Component {
91
94
  });
92
95
  }
93
96
  shouldComponentUpdate() {
94
- const shouldRender = this.isNotified;
97
+ const shouldRender = this.isNotified || this.hasChangedComponent;
95
98
  this.isNotified = false;
96
99
  this.isReconciling = false;
97
100
  return shouldRender;
@@ -100,7 +103,9 @@ export class RaskComponent extends Component {
100
103
  currentComponent = this;
101
104
  const stopObserving = this.observer.observe();
102
105
  try {
103
- if (!this.renderFn) {
106
+ if (this.hasChangedComponent) {
107
+ this.hasChangedComponent = false;
108
+ this.componentWillUnmount();
104
109
  this.reactiveProps = createReactiveProps(this);
105
110
  const component = this.props.__component;
106
111
  const renderFn = component(this.reactiveProps);
@@ -3,5 +3,5 @@ import { createComponentVNode as infernoCreateComponentVnode, } from "inferno";
3
3
  import { RaskComponent } from "./component";
4
4
  export function createComponentVNode(_, component, props = {}, key, ref) {
5
5
  props.__component = component;
6
- return infernoCreateComponentVnode(4 /* VNodeFlags.ComponentClass */, RaskComponent, props, key || component, ref);
6
+ return infernoCreateComponentVnode(4 /* VNodeFlags.ComponentClass */, RaskComponent, props, key, ref);
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rask-ui",
3
- "version": "0.28.1",
3
+ "version": "0.28.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",