Skip to content

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

chore(comments): disable comments count on public traces (#3065)

marliessophie06233f878c15
diff --git a/web/src/components/trace/TraceTimelineView.tsx b/web/src/components/trace/TraceTimelineView.tsx
index a221d138b7..2b82666e5c 100644
--- a/web/src/components/trace/TraceTimelineView.tsx
+++ b/web/src/components/trace/TraceTimelineView.tsx
@@ -30,6 +30,7 @@ import { TracePreview } from "@/src/components/trace/TracePreview";
import { ObservationPreview } from "@/src/components/trace/ObservationPreview";
import useSessionStorage from "@/src/components/useSessionStorage";
import { api } from "@/src/utils/api";
+import { useSession } from "next-auth/react";
// Fixed widths for styling for v1
const SCALE_WIDTH = 800;
@@ -310,6 +311,8 @@ export function TraceTimelineView({
[nestedObservations],
);
+ const session = useSession();
+
const observationCommentCounts = api.comments.getCountsByObjectIds.useQuery(
{
projectId: trace.projectId,
@@ -323,6 +326,7 @@ export function TraceTimelineView({
},
},
refetchOnMount: false, // prevents refetching loops
+ enabled: session.status === "authenticated",
},
);
@@ -339,6 +343,7 @@ export function TraceTimelineView({
},
},
refetchOnMount: false, // prevents refetching loops
+ enabled: session.status === "authenticated",
},
);
diff --git a/web/src/components/trace/index.tsx b/web/src/components/trace/index.tsx
index 67ad125122..d34cfa2430 100644
--- a/web/src/components/trace/index.tsx
+++ b/web/src/components/trace/index.tsx
@@ -61,6 +61,8 @@ export function Trace(props: {
return props.observations.map(({ id }) => id);
}, [props.observations]);
+ const session = useSession();
+
const observationCommentCounts = api.comments.getCountsByObjectIds.useQuery(
{
projectId: props.trace.projectId,
@@ -74,6 +76,7 @@ export function Trace(props: {
},
},
refetchOnMount: false, // prevents refetching loops
+ enabled: session.status === "authenticated",
},
);
@@ -90,6 +93,7 @@ export function Trace(props: {
},
},
refetchOnMount: false, // prevents refetching loops
+ enabled: session.status === "authenticated",
},
);