Skip to content

Commit 9371045

Browse files
committed
DCAT-22: Move delay to a file in constant
1 parent 17494ef commit 9371045

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/ts/constants/submitDelay.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* The delay in milliseconds before submitting a search query.
3+
*
4+
* This constant is used to implement a debounce mechanism for search inputs.
5+
* It helps reduce the number of API calls made while the user is still typing,
6+
* by waiting for a brief pause in input before submitting the query.
7+
*
8+
* @constant
9+
* @type {number}
10+
* @default 600
11+
*/
12+
export const SUBMIT_DELAY_MS = 600

src/ts/pages/DataCatalog/DataCatalog.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ import {
4646
QueryResult
4747
} from '../../../types/global'
4848
import { getKeywordWithWildcard } from '../../utils/getKeywordWithWildcard'
49-
50-
// Amount of time to delay submission and wait for more input
51-
const SUBMIT_DELAY_MS = 600
49+
import { SUBMIT_DELAY_MS } from '../../constants/submitDelay'
5250

5351
interface AutoSaveFormikProps {
5452
isLoading: boolean;

0 commit comments

Comments
 (0)