Skip to content

Commit 30df141

Browse files
marcaaronOSBotify
authored andcommitted
Merge pull request #60417 from callstack-internal/fix/59262-search-results
[CP Staging] Revert the debounced search in Search (cherry picked from commit bcc30a9) (CP triggered by marcaaron)
1 parent 2299bcf commit 30df141

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

src/components/Search/SearchAutocompleteInput.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable rulesdir/no-acc-spread-in-reduce */
2-
import lodashDebounce from 'lodash/debounce';
32
import type {ForwardedRef, ReactNode, RefObject} from 'react';
4-
import React, {forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useState} from 'react';
3+
import React, {forwardRef, useCallback, useEffect, useLayoutEffect, useMemo} from 'react';
54
import {View} from 'react-native';
65
import type {StyleProp, TextInputProps, ViewStyle} from 'react-native';
76
import {useOnyx} from 'react-native-onyx';
@@ -135,18 +134,6 @@ function SearchAutocompleteInput(
135134
return focusedSharedValue.get() ? wrapperFocusedStyle : wrapperStyle ?? {};
136135
});
137136

138-
const [localValue, setLocalValue] = useState(value);
139-
140-
const debouncedOnSearchQueryChange = useMemo(() => lodashDebounce(onSearchQueryChange, CONST.TIMING.USE_DEBOUNCED_STATE_DELAY), [onSearchQueryChange]);
141-
142-
const handleChangeText = useCallback(
143-
(text: string) => {
144-
setLocalValue(text);
145-
debouncedOnSearchQueryChange(text);
146-
},
147-
[debouncedOnSearchQueryChange],
148-
);
149-
150137
useEffect(() => {
151138
runOnLiveMarkdownRuntime(() => {
152139
'worklet';
@@ -206,8 +193,8 @@ function SearchAutocompleteInput(
206193
>
207194
<TextInput
208195
testID="search-autocomplete-text-input"
209-
value={localValue}
210-
onChangeText={handleChangeText}
196+
value={value}
197+
onChangeText={onSearchQueryChange}
211198
autoFocus={autoFocus}
212199
shouldDelayFocus={shouldDelayFocus}
213200
caretHidden={caretHidden}

0 commit comments

Comments
 (0)