Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(trace): don't refetch observations on click (#10377)

Nimar4a57706b5060
diff --git a/web/src/components/trace/ObservationPreview.tsx b/web/src/components/trace/ObservationPreview.tsx
index 5e47da9bda..61449c0c92 100644
--- a/web/src/components/trace/ObservationPreview.tsx
+++ b/web/src/components/trace/ObservationPreview.tsx
@@ -87,12 +87,17 @@ export const ObservationPreview = ({
(s) => s.observationId === currentObservationId,
);
- const observationWithInputAndOutput = api.observations.byId.useQuery({
- observationId: currentObservationId,
- startTime: currentObservation?.startTime,
- traceId: traceId,
- projectId: projectId,
- });
+ const observationWithInputAndOutput = api.observations.byId.useQuery(
+ {
+ observationId: currentObservationId,
+ startTime: currentObservation?.startTime,
+ traceId: traceId,
+ projectId: projectId,
+ },
+ {
+ staleTime: 5 * 60 * 1000, // 5 minutes - matches prefetch staleTime
+ },
+ );
const observationMedia = api.media.getByTraceOrObservationId.useQuery(
{