mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 21:02: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 urlQuery = useUrlQuery();
|
||||||
const urlQueryString = urlQuery.get('q');
|
const urlQueryString = urlQuery.get('q');
|
||||||
|
|
||||||
const debouncedHandleSearch = useMemo(() => debounce(handleSearch, 600), [
|
|
||||||
handleSearch,
|
|
||||||
]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const debouncedHandleSearch = debounce(handleSearch, 600);
|
||||||
debouncedHandleSearch(urlQueryString || '');
|
debouncedHandleSearch(urlQueryString || '');
|
||||||
|
|
||||||
|
return (): void => {
|
||||||
|
debouncedHandleSearch.cancel();
|
||||||
|
};
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [urlQueryString, maxTime, minTime, idEnd, idStart, logLinesPerPage]);
|
}, [
|
||||||
|
urlQueryString,
|
||||||
|
maxTime,
|
||||||
|
minTime,
|
||||||
|
idEnd,
|
||||||
|
idStart,
|
||||||
|
logLinesPerPage,
|
||||||
|
dispatch,
|
||||||
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
@ -161,7 +170,6 @@ function SearchFilter({
|
|||||||
debouncedupdateQueryString(value);
|
debouncedupdateQueryString(value);
|
||||||
}}
|
}}
|
||||||
allowClear
|
allowClear
|
||||||
onSearch={handleSearch}
|
|
||||||
/>
|
/>
|
||||||
</Popover>
|
</Popover>
|
||||||
</Container>
|
</Container>
|
||||||
@ -169,12 +177,8 @@ function SearchFilter({
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface DispatchProps {
|
interface DispatchProps {
|
||||||
getLogs: (
|
getLogs: typeof getLogs;
|
||||||
props: Parameters<typeof getLogs>[0],
|
getLogsAggregate: typeof getLogsAggregate;
|
||||||
) => (dispatch: Dispatch<AppActions>) => void;
|
|
||||||
getLogsAggregate: (
|
|
||||||
props: Parameters<typeof getLogsAggregate>[0],
|
|
||||||
) => (dispatch: Dispatch<AppActions>) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchFilterProps = DispatchProps;
|
type SearchFilterProps = DispatchProps;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user