Skip to content

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

fix(ui): improve /trace/:id redirect when trace is accessed while still being processed (#4868)

Marc Klingen90bab4386f3f
diff --git a/web/src/pages/trace/[traceId].tsx b/web/src/pages/trace/[traceId].tsx
index ab206a3bb4..0e8cef6781 100644
--- a/web/src/pages/trace/[traceId].tsx
+++ b/web/src/pages/trace/[traceId].tsx
@@ -16,7 +16,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
const traces = await getTracesByIdsForAnyProject([traceId]);
- if (!traces || traces.length === 0 || traces.length > 1) {
+ if (!traces || traces.length === 0) {
return {
props: {
notFound: true,
@@ -24,6 +24,14 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
};
}
+ if (traces.length > 1) {
+ return {
+ props: {
+ duplicatesFound: true,
+ },
+ };
+ }
+
return {
redirect: {
destination: `/project/${traces[0].projectId}/traces/${traceId}`,
@@ -32,7 +40,13 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
};
};
-const TraceRedirectPage = ({ notFound }: { notFound?: boolean }) => {
+const TraceRedirectPage = ({
+ notFound,
+ duplicatesFound,
+}: {
+ notFound?: boolean;
+ duplicatesFound?: boolean;
+}) => {
const router = useRouter();
if (router.isFallback) {
return <div>Loading...</div>;
@@ -40,7 +54,23 @@ const TraceRedirectPage = ({ notFound }: { notFound?: boolean }) => {
if (notFound) {
return (
- <ErrorPage message="Trace not found. Please upgrade the SDK as we changed the URL schema." />
+ <ErrorPage
+ title="Trace not found"
+ message="The trace is either still being processed or has been deleted."
+ additionalButton={{
+ label: "Retry",
+ onClick: () => void window.location.reload(),
+ }}
+ />
+ );
+ }
+
+ if (duplicatesFound) {
+ return (
+ <ErrorPage
+ title="Trace not found"
+ message="Please upgrade the SDK as the URL schema has changed."
+ />
);
}