Skip to content

Commit 7779346

Browse files
committed
feat: add debounce to search
1 parent bab1fba commit 7779346

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/common/DiffViewer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import DiffSection from './Diff/DiffSection'
88
import DiffLoading from './Diff/DiffLoading'
99
import UsefulContentSection from './UsefulContentSection'
1010
import ViewStyleOptions from './Diff/DiffViewStyleOptions'
11-
1211
import CompletedFilesCounter from './CompletedFilesCounter'
1312

1413
const Container = styled.div`
@@ -95,7 +94,12 @@ const DiffViewer = ({
9594
setLoading(false)
9695
}
9796

98-
fetchDiff()
97+
const debounce = setTimeout(() => {
98+
fetchDiff()
99+
}, 750)
100+
return () => {
101+
clearTimeout(debounce)
102+
}
99103
}, [appName, fromVersion, replaceAppName, showDiff, toVersion])
100104

101105
if (!showDiff) {

0 commit comments

Comments
 (0)