Skip to content

Commit e7dfcc1

Browse files
committed
ref(cmd-k): Address review feedback from JonasBa
- Merge state sync and hadInteraction effects into one useEffect - Remove hardcoded "500ms" from debounce comment
1 parent b1cd93d commit e7dfcc1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

static/app/components/commandPalette/useCommandPaletteAnalytics.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,14 @@ export function useCommandPaletteAnalytics(filteredActionCount: number): {
5454
state,
5555
});
5656

57-
useEffect(() => {
58-
analyticsState.current.state = state;
59-
});
60-
61-
// Track any query input as interaction immediately (not debounced)
6257
useEffect(() => {
6358
if (state.query.length > 0) {
6459
analyticsState.current.hadInteraction = true;
6560
}
66-
}, [state.query]);
61+
analyticsState.current.state = state;
62+
}, [state]);
6763

68-
// Debounced query tracking (500ms)
64+
// Debounced query tracking
6965
useEffect(() => {
7066
const s = analyticsState.current;
7167
if (state.query.length === 0 || state.query === s.lastTrackedQuery) {

0 commit comments

Comments
 (0)