소스 검색

Debounces event handler for graph search

main
Keith Daulton 2 년 전
부모
커밋
333758c35d
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. +3
    -2
      src/webviews/apps/plus/graph/GraphWrapper.tsx

+ 3
- 2
src/webviews/apps/plus/graph/GraphWrapper.tsx 파일 보기

@ -26,6 +26,7 @@ import type {
} from '../../../../plus/webviews/graph/protocol';
import type { Subscription } from '../../../../subscription';
import { getSubscriptionTimeRemaining, SubscriptionState } from '../../../../subscription';
import { debounce } from '../../../../system/function';
import { pluralize } from '../../../../system/string';
import { SearchField, SearchNav } from '../../shared/components/search/react';
import type { DateTimeFormat } from '../../shared/date';
@ -347,7 +348,7 @@ export function GraphWrapper({
}
};
const handleSearchInput = (e: CustomEvent<SearchQuery>) => {
const handleSearchInput = debounce((e: CustomEvent<SearchQuery>) => {
const detail = e.detail;
setSearchQuery(detail);
@ -357,7 +358,7 @@ export function GraphWrapper({
setSearchResultIds(undefined);
}
onSearchCommits?.(isValid ? detail : undefined);
};
}, 250);
useLayoutEffect(() => {
if (mainRef.current === null) return;

불러오는 중...
취소
저장