Skip to content

Commit 326bb91

Browse files
chore(web): Add isBranchFilteringEnabled flag to search_finished event (#781)
1 parent 513a9ff commit 326bb91

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- Added `isBranchFilteringEnabled` flag to `search_finished` PostHog event. [#781](https://github.com/sourcebot-dev/sourcebot/pull/781)
12+
1013
## [4.10.15] - 2026-01-22
1114

1215
### Fixed

packages/web/src/app/[domain]/search/components/searchResultsPage.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ export const SearchResultsPage = ({
102102
])
103103
}, [searchQuery, setSearchHistory]);
104104

105+
// Look for any files that are not on the default branch.
106+
const isBranchFilteringEnabled = useMemo(() => {
107+
return files.some((file) => {
108+
return file.branches?.some((branch) => branch !== 'HEAD') ?? false;
109+
});
110+
}, [files]);
111+
105112
useEffect(() => {
106113
if (isStreaming || !stats) {
107114
return;
@@ -138,6 +145,7 @@ export const SearchResultsPage = ({
138145
flushReason: stats.flushReason,
139146
fileLanguages,
140147
isSearchExhaustive: isExhaustive,
148+
isBranchFilteringEnabled,
141149
});
142150
}, [
143151
captureEvent,
@@ -147,6 +155,7 @@ export const SearchResultsPage = ({
147155
stats,
148156
timeToSearchCompletionMs,
149157
timeToFirstSearchResultMs,
158+
isBranchFilteringEnabled,
150159
]);
151160

152161
const onLoadMoreResults = useCallback(() => {
@@ -157,13 +166,7 @@ export const SearchResultsPage = ({
157166
router.push(url);
158167
}, [maxMatchCount, router, searchQuery, domain]);
159168

160-
// Look for any files that are not on the default branch.
161-
const isBranchFilteringEnabled = useMemo(() => {
162-
return files.some((file) => {
163-
return file.branches?.some((branch) => branch !== 'HEAD') ?? false;
164-
});
165-
}, [files]);
166-
169+
167170
return (
168171
<div className="flex flex-col h-screen overflow-clip">
169172
{/* TopBar */}

packages/web/src/lib/posthogEvents.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export type PosthogEventMap = {
2727
regexpsConsidered: number,
2828
flushReason: string,
2929
fileLanguages: string[],
30-
isSearchExhaustive: boolean
30+
isSearchExhaustive: boolean,
31+
isBranchFilteringEnabled: boolean,
3132
},
3233
////////////////////////////////////////////////////////////////
3334
wa_trial_nav_pressed: {},

0 commit comments

Comments
 (0)