Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 404092a

Browse files
authored
DEV: Add appEvents trigger when Ai search results toggled (#1052)
This PR adds appEvents triggers when Ai search results are toggled.
1 parent 327adbd commit 404092a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

assets/javascripts/discourse/components/ai-full-page-search.gjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { i18n } from "discourse-i18n";
1313
import DTooltip from "float-kit/components/d-tooltip";
1414
import AiIndicatorWave from "./ai-indicator-wave";
1515

16+
const AI_RESULTS_TOGGLED = "full-page-search:ai-results-toggled";
17+
1618
export default class AiFullPageSearch extends Component {
1719
@service appEvents;
1820
@service router;
@@ -131,6 +133,9 @@ export default class AiFullPageSearch extends Component {
131133

132134
@action
133135
toggleAiResults() {
136+
this.appEvents.trigger(AI_RESULTS_TOGGLED, {
137+
enabled: !this.showingAiResults,
138+
});
134139
if (this.showingAiResults) {
135140
this.args.addSearchResults([], "topic_id");
136141
} else {
@@ -144,6 +149,9 @@ export default class AiFullPageSearch extends Component {
144149
this.AiResults = [];
145150
this.showingAiResults = false;
146151
this.args.addSearchResults([], "topic_id");
152+
this.appEvents.trigger(AI_RESULTS_TOGGLED, {
153+
enabled: false,
154+
});
147155
}
148156

149157
performHyDESearch() {

0 commit comments

Comments
 (0)