Closed mogera551 closed 3 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;
}
}
そこではなかった。 Phaseは、以下の通りだけど、applyToNodeは使われていない。
/**
* @enum {number} 実行フェーズ
*/
export const Phase = {
sleep: 0 ,
updateViewModel: 1,
gatherUpdatedProperties: 2,
applyToNode: 3,
terminate: 100,
};
componentのbuild中、Phase.sleepなので、WritableViewModelが選択されている。 build中のconnectedCallback以降、キャッシュ可能フラグを立てて、ReadOnlyViewModelを選択するようにする。 Phase.applyToNodeは紛らわしいので廃止
/* Comonent/props.js #bindProperty */
handler.component.parentComponent.writableViewModel
→
handler.component.parentComponent.viewModel
再構築するプロパティ以外は、キャッシュしても良いのでは?