mogera551 / quel

more declarative javascript front-end-framework
MIT License
0 stars 0 forks source link

updateNodeで、再構築中(branch、repeat、repeatKeyed)にキャッシュが効かないので遅い #45

Closed mogera551 closed 3 months ago

mogera551 commented 4 months ago

再構築するプロパティ以外は、キャッシュしても良いのでは?

mogera551 commented 4 months ago

Phase.applyNodeでthis.writableViewModelを使ってるからでは?

/* MIxedComponent */

  get viewModel() {
    if (typeof this.updateSlot === "undefined" || 
      (this.updateSlot.phase !== Phase.gatherUpdatedProperties)) {
      return this.writableViewModel;
    } else {
      return this.readOnlyViewModel;
    }
  }
mogera551 commented 4 months ago

そこではなかった。 Phaseは、以下の通りだけど、applyToNodeは使われていない。

/**
 * @enum {number} 実行フェーズ
 */
export const Phase = {
  sleep: 0 ,
  updateViewModel: 1,
  gatherUpdatedProperties: 2,
  applyToNode: 3,
  terminate: 100,
};
mogera551 commented 4 months ago

componentのbuild中、Phase.sleepなので、WritableViewModelが選択されている。 build中のconnectedCallback以降、キャッシュ可能フラグを立てて、ReadOnlyViewModelを選択するようにする。 Phase.applyToNodeは紛らわしいので廃止

mogera551 commented 4 months ago
/* Comonent/props.js #bindProperty */
handler.component.parentComponent.writableViewModel
→
handler.component.parentComponent.viewModel