@@ -40,7 +40,19 @@ export class RuleEngineBasesView extends BasesView implements HoverParent {
4040 return ( hash >>> 0 ) . toString ( 16 ) ;
4141 }
4242
43+ onload ( ) : void {
44+ this . plugin . activeBasesView = this ;
45+ }
46+ onunload ( ) : void {
47+ this . plugin . activeBasesView = undefined ;
48+ }
49+
4350 public processView ( ignoreDataHash = false ) : void {
51+ this . plugin ?. debug ( `processView` , { ignoreDataHash } ) ;
52+ //account for base views changing quickly
53+ if ( ! this . plugin . activeBasesView ) {
54+ this . plugin . activeBasesView = this ;
55+ }
4456 this . containerEl . empty ( ) ;
4557
4658 // --- 1. Container Baseline Style ---
@@ -57,6 +69,7 @@ export class RuleEngineBasesView extends BasesView implements HoverParent {
5769
5870 const layoutMode = this . config . get ( 'layout' ) ?? 'table' ;
5971 const order = this . config . getOrder ( ) ;
72+ this . plugin . debug ( `applying layout` , layoutMode ) ;
6073
6174 if ( layoutMode === 'table' ) {
6275 const table = this . containerEl . createEl ( 'table' ) ;
@@ -95,13 +108,21 @@ export class RuleEngineBasesView extends BasesView implements HoverParent {
95108 }
96109 }
97110
98- const canProcessCommands = Boolean ( this . config . get ( 'enableCommands' ) && ( ignoreDataHash ? true : this . plugin . settings . processBaseResultsAutomatically ) ) ;
111+ const viewEnabledCommands = Boolean ( this . config . get ( 'enableCommands' ) ) ;
112+ const autoProcess = this . plugin . settings . processBaseResultsAutomatically ;
113+ const canProcessCommands = viewEnabledCommands && ( ignoreDataHash || autoProcess ) ;
114+ this . plugin . debug ( `canProcessCommands` , {
115+ canProcessCommands,
116+ viewEnabledCommands,
117+ ignoreDataHash,
118+ autoProcess
119+ } ) ;
99120 if ( canProcessCommands ) {
100121 const thisHash = this . currentDataHash ;
101- const dataChanged = this . lastDataHash !== thisHash ;
102- // Command execution only takes place if the data has changed, not the order or grouping
103- if ( dataChanged || ignoreDataHash ) {
104- this . plugin . debug ( `${ dataChanged ? 'data changed' : ignoreDataHash ? 'ignoring data hash' : '' } - processing commands...` )
122+ // Command execution only takes place automatically if the data has changed, not the order or grouping
123+ const willRunCommands = ignoreDataHash || this . lastDataHash !== thisHash ;
124+ if ( willRunCommands ) {
125+ this . plugin . debug ( `${ willRunCommands ? 'data changed' : ignoreDataHash ? 'ignoring data hash' : '' } - processing commands...` )
105126 const groupLeaf = this . app . workspace . getLeaf ( "split" , "vertical" ) ;
106127 groupLeaf . setGroup ( "ore-leaf-group" ) ;
107128 for ( const group of this . data . groupedData ) {
@@ -112,6 +133,7 @@ export class RuleEngineBasesView extends BasesView implements HoverParent {
112133 }
113134 this . lastDataHash = thisHash ;
114135 }
136+ groupLeaf . detach ( ) ;
115137 }
116138 }
117139 }
0 commit comments