Skip to content

Commit

Permalink
enhance(telemetry): measure search source + change (#12000)
Browse files Browse the repository at this point in the history
* enhance(telemetry): add id to quick-search measurement

* enhance(telemetry): measure initial search input change
  • Loading branch information
caugner authored Oct 22, 2024
1 parent 50518f3 commit 3ec66c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/src/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function InnerSearchNavigateWidget(props: InnerSearchNavigateWidgetProps) {
);

const resultClick: React.MouseEventHandler<HTMLAnchorElement> = () => {
gleanClick(quicksearchPing(inputValue));
gleanClick(quicksearchPing(`${id} -> ${inputValue}`));
};

const {
Expand Down Expand Up @@ -325,6 +325,8 @@ function InnerSearchNavigateWidget(props: InnerSearchNavigateWidgetProps) {
);
}, [resultItems, inputValue]);

const [hasChanged, setHasChanged] = useState(false);

const searchResults = (() => {
if (!isOpen || !inputValue.trim()) {
return null;
Expand Down Expand Up @@ -493,6 +495,10 @@ function InnerSearchNavigateWidget(props: InnerSearchNavigateWidgetProps) {
onChange(event) {
if (event.target instanceof HTMLInputElement) {
onChangeInputValue(event.target.value);
if (!hasChanged) {
gleanClick(`quick-search-change: ${id}`);
setHasChanged(true);
}
}
},
ref: (input) => {
Expand Down

0 comments on commit 3ec66c2

Please sign in to comment.