PluginProbe
Code Snippets / 4.0.0-beta.3
Code Snippets v4.0.0-beta.3
4.0.0-beta.3 4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 All 66 releases
← All changes | js/hooks/useDuplicateReports.ts +2 -4 4.0.0-beta.2 → 4.0.0-beta.3 View file →
@@ -1,6 +1,7 @@
1 1 import { useEffect, useState } from 'react'
2 2 import { addQueryArg } from '../utils/restAPI'
3 +import { TIMEOUTS } from '../../../tests/e2e/helpers/constants'
3 4 import { useRestAPI } from './useRestAPI'
4 5 import type { DuplicateReport, DuplicateSearchResponse } from '../types/Feedback'
5 6
6 7 /** Shortest title worth looking for existing reports of. */
@@ -5,11 +6,8 @@
5 6
6 7 /** Shortest title worth looking for existing reports of. */
7 8 const MIN_SEARCH_LENGTH = 6
8 9
9 -/** How long to wait after the last keystroke before searching. */
10 -const SEARCH_DEBOUNCE_MS = 600
11 -
12 10 /**
13 11 * Offer reports already filed about whatever is being described, so the same problem is
14 12 * not reported twice. A cloud that cannot answer leaves the list empty rather than
15 13 * interrupting the report being written.
@@ -31,9 +29,9 @@
31 29 const timer = setTimeout(() => {
32 30 api.get<DuplicateSearchResponse>(addQueryArg({ url: searchUrl, name: 'q', value: query }))
33 31 .then(data => active && setDuplicates(data.results))
34 32 .catch(() => active && setDuplicates([]))
35 - }, SEARCH_DEBOUNCE_MS)
33 + }, TIMEOUTS.VERY_SHORT)
36 34
37 35 return () => {
38 36 active = false
39 37 clearTimeout(timer)