@@ -4,13 +4,11 @@ import type { ViewFieldVariable } from 'packages/core/src/fields/viewFields/View
44import type { IPlugin } from 'packages/core/src/IPlugin' ;
55import type { DerivedMetadataSubscription } from 'packages/core/src/metadata/DerivedMetadataSubscription' ;
66import { Mountable } from 'packages/core/src/utils/Mountable' ;
7- import { Signal } from 'packages/core/src/utils/Signal' ;
87import { DomHelpers } from 'packages/core/src/utils/Utils' ;
98
109export abstract class AbstractViewField < T > extends Mountable {
1110 readonly plugin : IPlugin ;
1211 readonly mountable : ViewFieldMountable ;
13- readonly metadataSignal : Signal < T | undefined > ;
1412
1513 private metadataSubscription ?: DerivedMetadataSubscription ;
1614
@@ -24,7 +22,6 @@ export abstract class AbstractViewField<T> extends Mountable {
2422
2523 this . mountable = mountable ;
2624 this . plugin = mountable . plugin ;
27- this . metadataSignal = new Signal < T | undefined > ( undefined ) ;
2825
2926 this . variables = [ ] ;
3027
@@ -47,15 +44,12 @@ export abstract class AbstractViewField<T> extends Mountable {
4744 }
4845
4946 await this . onInitialRender ( targetEl ) ;
50-
51- await this . rerender ( targetEl , undefined ) ;
5247 }
5348
5449 protected abstract onInitialRender ( container : HTMLElement ) : void | Promise < void > ;
5550
5651 private async rerender ( targetEl : HTMLElement , value : T | undefined ) : Promise < void > {
5752 if ( ! this . hidden ) {
58- DomHelpers . empty ( targetEl ) ;
5953 await this . onRerender ( targetEl , value ) ;
6054 }
6155 }
@@ -65,7 +59,7 @@ export abstract class AbstractViewField<T> extends Mountable {
6559 protected onMount ( targetEl : HTMLElement ) : void {
6660 this . buildVariables ( ) ;
6761
68- this . metadataSignal . registerListener ( { callback : value => void this . rerender ( targetEl , value ) } ) ;
62+ void this . initialRender ( targetEl ) ;
6963
7064 this . metadataSubscription = this . mountable . plugin . metadataManager . subscribeDerived (
7165 this . mountable . getUuid ( ) ,
@@ -79,12 +73,9 @@ export abstract class AbstractViewField<T> extends Mountable {
7973 } ,
8074 ( ) => this . mountable . unmount ( ) ,
8175 ) ;
82-
83- void this . initialRender ( targetEl ) ;
8476 }
8577
8678 protected onUnmount ( ) : void {
87- this . metadataSignal . unregisterAllListeners ( ) ;
8879 this . metadataSubscription ?. unsubscribe ( ) ;
8980 }
9081}
0 commit comments