@@ -72,7 +72,7 @@ import { HttpQuery } from "./httpQuery/httpQuery";
7272import { StreamQuery } from "./httpQuery/streamQuery" ;
7373import { QueryConfirmationModal } from "./queryComp/queryConfirmationModal" ;
7474import { QueryNotificationControl } from "./queryComp/queryNotificationControl" ;
75- import { QueryPropertyView } from "./queryComp/queryPropertyView" ;
75+ import { findDependentQueries , QueryPropertyView } from "./queryComp/queryPropertyView" ;
7676import { getTriggerType , onlyManualTrigger } from "./queryCompUtils" ;
7777import { messageInstance } from "lowcoder-design/src/components/GlobalInstances" ;
7878
@@ -100,6 +100,7 @@ interface AfterExecuteQueryAction {
100100export const TriggerTypeOptions = [
101101 { label : "On Page Load" , value : "onPageLoad" } ,
102102 { label : "On Input Change" , value : "onInputChange" } ,
103+ { label : "On Query Execution" , value : "onQueryExecution" } ,
103104 { label : trans ( "query.triggerTypeAuto" ) , value : "automatic" } ,
104105 { label : trans ( "query.triggerTypeManual" ) , value : "manual" } ,
105106] as const ;
@@ -159,6 +160,7 @@ const childrenMap = {
159160 } ,
160161 } ) ,
161162 cancelPrevious : withDefault ( BoolPureControl , false ) ,
163+ depQueryName : SimpleNameComp ,
162164} ;
163165
164166let QueryCompTmp = withTypeAndChildren < typeof QueryMap , ToInstanceType < typeof childrenMap > > (
@@ -639,6 +641,29 @@ export const QueryComp = withExposingConfigs(QueryCompTmp, [
639641const QueryListTmpComp = list ( QueryComp ) ;
640642
641643class QueryListComp extends QueryListTmpComp implements BottomResListComp {
644+ override reduce ( action : CompAction ) : this {
645+ if ( isCustomAction < AfterExecuteQueryAction > ( action , "afterExecQuery" ) ) {
646+ if ( action . path ?. length === 1 && ! isNaN ( parseInt ( action . path [ 0 ] ) ) ) {
647+ const queryIdx = parseInt ( action . path [ 0 ] ) ;
648+ const queryComps = this . getView ( ) ;
649+ const queryName = queryComps ?. [ queryIdx ] ?. children . name . getView ( ) ;
650+ const dependentQueries = queryComps . filter ( ( query , idx ) => {
651+ if ( queryIdx === idx ) return false ;
652+ if (
653+ getTriggerType ( query ) === 'onQueryExecution'
654+ && query . children . depQueryName . getView ( ) === queryName
655+ ) {
656+ return true ;
657+ }
658+ } )
659+ dependentQueries ?. forEach ( ( query ) => {
660+ query . dispatch ( deferAction ( executeQueryAction ( { } ) ) ) ;
661+ } )
662+ }
663+ }
664+ return super . reduce ( action ) ;
665+ }
666+
642667 nameAndExposingInfo ( ) : NameAndExposingInfo {
643668 const result : NameAndExposingInfo = { } ;
644669 Object . values ( this . children ) . forEach ( ( comp ) => {
0 commit comments