mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-30 23:52:00 +08:00
fix: Logs double api is called (#1947)
This commit is contained in:
parent
f0e13784e5
commit
27cd514fa5
@ -120,14 +120,23 @@ function SearchFilter({
|
||||
const urlQuery = useUrlQuery();
|
||||
const urlQueryString = urlQuery.get('q');
|
||||
|
||||
const debouncedHandleSearch = useMemo(() => debounce(handleSearch, 600), [
|
||||
handleSearch,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
const debouncedHandleSearch = debounce(handleSearch, 600);
|
||||
debouncedHandleSearch(urlQueryString || '');
|
||||
|
||||
return (): void => {
|
||||
debouncedHandleSearch.cancel();
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [urlQueryString, maxTime, minTime, idEnd, idStart, logLinesPerPage]);
|
||||
}, [
|
||||
urlQueryString,
|
||||
maxTime,
|
||||
minTime,
|
||||
idEnd,
|
||||
idStart,
|
||||
logLinesPerPage,
|
||||
dispatch,
|
||||
]);
|
||||
|
||||
return (
|
||||
<Container>
|
||||
@ -161,7 +170,6 @@ function SearchFilter({
|
||||
debouncedupdateQueryString(value);
|
||||
}}
|
||||
allowClear
|
||||
onSearch={handleSearch}
|
||||
/>
|
||||
</Popover>
|
||||
</Container>
|
||||
@ -169,12 +177,8 @@ function SearchFilter({
|
||||
}
|
||||
|
||||
interface DispatchProps {
|
||||
getLogs: (
|
||||
props: Parameters<typeof getLogs>[0],
|
||||
) => (dispatch: Dispatch<AppActions>) => void;
|
||||
getLogsAggregate: (
|
||||
props: Parameters<typeof getLogsAggregate>[0],
|
||||
) => (dispatch: Dispatch<AppActions>) => void;
|
||||
getLogs: typeof getLogs;
|
||||
getLogsAggregate: typeof getLogsAggregate;
|
||||
}
|
||||
|
||||
type SearchFilterProps = DispatchProps;
|
||||
|
Loading…
x
Reference in New Issue
Block a user