fix: thread environment into correlation-chain query in ExchangeHeader

The env-scoping migration (P3A) changed useCorrelationChain to require an
environment arg and gate on `enabled: !!correlationId && !!environment`,
but ExchangeHeader was still calling it with one arg. Result: the query
never fired, so the header always rendered "no correlated exchanges
found" even when 4+ exchanges shared a correlationId.

Fix: read the selected env from the Zustand environment store and pass
it through.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-17 10:13:32 +02:00
parent b7a107d33f
commit f04e77788e

View File

@@ -6,6 +6,7 @@ import { useCorrelationChain } from '../../api/queries/correlation';
import { useAgents } from '../../api/queries/agents'; import { useAgents } from '../../api/queries/agents';
import { useCatalog } from '../../api/queries/catalog'; import { useCatalog } from '../../api/queries/catalog';
import { useCanControl } from '../../auth/auth-store'; import { useCanControl } from '../../auth/auth-store';
import { useEnvironmentStore } from '../../api/environment-store';
import type { ExecutionDetail } from '../../components/ExecutionDiagram/types'; import type { ExecutionDetail } from '../../components/ExecutionDiagram/types';
import { attributeBadgeColor } from '../../utils/attribute-color'; import { attributeBadgeColor } from '../../utils/attribute-color';
import { formatDuration, statusLabel } from '../../utils/format-utils'; import { formatDuration, statusLabel } from '../../utils/format-utils';
@@ -32,7 +33,8 @@ function statusVariant(s: string): StatusVariant {
export function ExchangeHeader({ detail, onCorrelatedSelect, onClearSelection }: ExchangeHeaderProps) { export function ExchangeHeader({ detail, onCorrelatedSelect, onClearSelection }: ExchangeHeaderProps) {
const navigate = useNavigate(); const navigate = useNavigate();
const { timeRange } = useGlobalFilters(); const { timeRange } = useGlobalFilters();
const { data: chainResult } = useCorrelationChain(detail.correlationId ?? null); const environment = useEnvironmentStore((s) => s.environment);
const { data: chainResult } = useCorrelationChain(detail.correlationId ?? null, environment);
const chain = chainResult?.data; const chain = chainResult?.data;
const showChain = chain && chain.length > 1; const showChain = chain && chain.length > 1;
const attrs = Object.entries(detail.attributes ?? {}); const attrs = Object.entries(detail.attributes ?? {});