Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: Logs double api is called (#1947)

Palash Gupta27cd514fa599
diff --git a/frontend/src/container/LogsSearchFilter/index.tsx b/frontend/src/container/LogsSearchFilter/index.tsx
index b5cb71faa9..5b0136627f 100644
--- a/frontend/src/container/LogsSearchFilter/index.tsx
+++ b/frontend/src/container/LogsSearchFilter/index.tsx
@@ -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;