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: added fix for context query not getting updated (#8941)

Abhi kumar912a34da8de7
diff --git a/frontend/src/components/LogDetail/index.tsx b/frontend/src/components/LogDetail/index.tsx
index 6fd66e20b5..8e894cf218 100644
--- a/frontend/src/components/LogDetail/index.tsx
+++ b/frontend/src/components/LogDetail/index.tsx
@@ -39,7 +39,7 @@ import {
TextSelect,
X,
} from 'lucide-react';
-import { useMemo, useState } from 'react';
+import { useCallback, useMemo, useState } from 'react';
import { useSelector } from 'react-redux';
import { useCopyToClipboard, useLocation } from 'react-use';
import { AppState } from 'store/reducers';
@@ -146,6 +146,34 @@ function LogDetailInner({
safeNavigate(`${ROUTES.LOGS_EXPLORER}?${createQueryParams(queryParams)}`);
};
+ const handleQueryExpressionChange = useCallback(
+ (value: string, queryIndex: number) => {
+ // update the query at the given index
+ setContextQuery((prev) => {
+ if (!prev) return prev;
+
+ return {
+ ...prev,
+ builder: {
+ ...prev.builder,
+ queryData: prev.builder.queryData.map((query, idx) =>
+ idx === queryIndex
+ ? {
+ ...query,
+ filter: {
+ ...query.filter,
+ expression: value,
+ },
+ }
+ : query,
+ ),
+ },
+ };
+ });
+ },
+ [],
+ );
+
const handleRunQuery = (expression: string): void => {
let updatedContextQuery = cloneDeep(contextQuery);
@@ -309,7 +337,7 @@ function LogDetailInner({
{isFilterVisible && contextQuery?.builder.queryData[0] && (
<div className="log-detail-drawer-query-container">
<QuerySearch
- onChange={(): void => {}}
+ onChange={(value): void => handleQueryExpressionChange(value, 0)}
dataSource={DataSource.LOGS}
queryData={contextQuery?.builder.queryData[0]}
onRun={handleRunQuery}