fix(lens): refresh content using resolved trace references

This commit is contained in:
moe-berri 2026-10-06 14:44:12 -07:00
parent 5a040c0b11
commit 8e16d39e72
2 changed files with 7 additions and 2 deletions

View file

@ -48,6 +48,10 @@ describe("TraceConversation", () => {
it.each([false, true])("refreshes unchanged spans without hiding loaded content on failure (%s)", async (failed) => {
const user = userEvent.setup();
vi.mocked(agentTraceCall).mockResolvedValue({
...trace,
summary: { ...trace.summary, trace_ref: "resolved-reference" },
});
renderWithProviders(
<RoutedRunView traceId={trace.summary.trace_id} accessToken="test" onBack={vi.fn()} embedded />,
);

View file

@ -116,9 +116,10 @@ function LoadedRun({
};
const refreshRun = () =>
readManually(async () => {
await traceQuery.refetch();
const refreshed = await traceQuery.refetch();
const contentRef = refreshed.data?.pages[0].summary.trace_ref ?? traceRef;
await queryClient.invalidateQueries({
queryKey: ["agentTraceSpan", traceId, traceRef],
queryKey: ["agentTraceSpan", traceId, contentRef],
predicate: (query) => query.queryKey.at(-1) === accessToken,
});
});