6
6
MagnifyingGlassPlusIcon ,
7
7
} from "@heroicons/react/20/solid" ;
8
8
import type { Location } from "@remix-run/react" ;
9
- import { useParams , useRevalidator } from "@remix-run/react" ;
10
- import { LoaderFunctionArgs } from "@remix-run/server-runtime" ;
9
+ import { useLoaderData , useParams , useRevalidator } from "@remix-run/react" ;
10
+ import { LoaderFunctionArgs , SerializeFrom } from "@remix-run/server-runtime" ;
11
11
import { Virtualizer } from "@tanstack/react-virtual" ;
12
12
import {
13
13
formatDurationMilliseconds ,
@@ -18,10 +18,10 @@ import { RuntimeEnvironmentType } from "@trigger.dev/database";
18
18
import { motion } from "framer-motion" ;
19
19
import { useCallback , useEffect , useRef , useState } from "react" ;
20
20
import { useHotkeys } from "react-hotkeys-hook" ;
21
- import { typedjson , useTypedLoaderData } from "remix-typedjson" ;
22
21
import { ShowParentIcon , ShowParentIconSelected } from "~/assets/icons/ShowParentIcon" ;
23
22
import tileBgPath from "~/assets/images/[email protected] " ;
24
23
import { BlankstateInstructions } from "~/components/BlankstateInstructions" ;
24
+ import { AdminDebugTooltip } from "~/components/admin/debugTooltip" ;
25
25
import { InlineCode } from "~/components/code/InlineCode" ;
26
26
import { EnvironmentLabel } from "~/components/environments/EnvironmentLabel" ;
27
27
import { MainCenteredContainer , PageBody } from "~/components/layout/AppLayout" ;
@@ -33,6 +33,7 @@ import { Input } from "~/components/primitives/Input";
33
33
import { NavBar , PageAccessories , PageTitle } from "~/components/primitives/PageHeader" ;
34
34
import { Paragraph } from "~/components/primitives/Paragraph" ;
35
35
import { Popover , PopoverArrowTrigger , PopoverContent } from "~/components/primitives/Popover" ;
36
+ import { Property , PropertyTable } from "~/components/primitives/PropertyTable" ;
36
37
import {
37
38
ResizableHandle ,
38
39
ResizablePanel ,
@@ -55,7 +56,7 @@ import { useProject } from "~/hooks/useProject";
55
56
import { useReplaceLocation } from "~/hooks/useReplaceLocation" ;
56
57
import { Shortcut , useShortcutKeys } from "~/hooks/useShortcutKeys" ;
57
58
import { useUser } from "~/hooks/useUser" ;
58
- import { RunEvent , RunPresenter } from "~/presenters/v3/RunPresenter.server" ;
59
+ import { RunPresenter } from "~/presenters/v3/RunPresenter.server" ;
59
60
import { getResizableRunSettings , setResizableRunSettings } from "~/services/resizablePanel" ;
60
61
import { requireUserId } from "~/services/session.server" ;
61
62
import { cn } from "~/utils/cn" ;
@@ -68,12 +69,12 @@ import {
68
69
v3RunsPath ,
69
70
} from "~/utils/pathBuilder" ;
70
71
import { SpanView } from "../resources.orgs.$organizationSlug.projects.v3.$projectParam.runs.$runParam.spans.$spanParam/route" ;
71
- import { AdminDebugTooltip } from "~/components/admin/debugTooltip" ;
72
- import { Property , PropertyTable } from "~/components/primitives/PropertyTable" ;
73
72
import { SimpleTooltip } from "~/components/primitives/Tooltip" ;
74
73
75
74
const MAX_LIVE_RELOADING_EVENTS = 500 ;
76
75
76
+ type TraceEvent = NonNullable < SerializeFrom < typeof loader > [ "trace" ] > [ "events" ] [ 0 ] ;
77
+
77
78
export const loader = async ( { request, params } : LoaderFunctionArgs ) => {
78
79
const userId = await requireUserId ( request ) ;
79
80
const { projectParam, organizationSlug, runParam } = v3RunParamsSchema . parse ( params ) ;
@@ -89,10 +90,11 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
89
90
//resizable settings
90
91
const resizeSettings = await getResizableRunSettings ( request ) ;
91
92
92
- return typedjson ( {
93
- ...result ,
93
+ return {
94
+ run : result . run ,
95
+ trace : result . trace ,
94
96
resizeSettings,
95
- } ) ;
97
+ } ;
96
98
} ;
97
99
98
100
function getSpanId ( location : Location < any > ) : string | undefined {
@@ -101,7 +103,7 @@ function getSpanId(location: Location<any>): string | undefined {
101
103
}
102
104
103
105
export default function Page ( ) {
104
- const { run, trace, resizeSettings } = useTypedLoaderData < typeof loader > ( ) ;
106
+ const { run, trace, resizeSettings } = useLoaderData < typeof loader > ( ) ;
105
107
const organization = useOrganization ( ) ;
106
108
const project = useProject ( ) ;
107
109
const user = useUser ( ) ;
@@ -258,7 +260,7 @@ export default function Page() {
258
260
} }
259
261
totalDuration = { duration }
260
262
rootSpanStatus = { rootSpanStatus }
261
- rootStartedAt = { rootStartedAt }
263
+ rootStartedAt = { rootStartedAt ? new Date ( rootStartedAt ) : undefined }
262
264
environmentType = { run . environment . type }
263
265
shouldLiveReload = { shouldLiveReload }
264
266
/>
@@ -281,7 +283,7 @@ export default function Page() {
281
283
}
282
284
283
285
type TasksTreeViewProps = {
284
- events : RunEvent [ ] ;
286
+ events : TraceEvent [ ] ;
285
287
selectedId ?: string ;
286
288
parentRunFriendlyId ?: string ;
287
289
onSelectedIdChanged : ( selectedId : string | undefined ) => void ;
@@ -762,7 +764,7 @@ function TimelineView({
762
764
) ;
763
765
}
764
766
765
- function NodeText ( { node } : { node : RunEvent } ) {
767
+ function NodeText ( { node } : { node : TraceEvent } ) {
766
768
const className = "truncate" ;
767
769
return (
768
770
< Paragraph variant = "small" className = { cn ( className ) } >
@@ -771,7 +773,7 @@ function NodeText({ node }: { node: RunEvent }) {
771
773
) ;
772
774
}
773
775
774
- function NodeStatusIcon ( { node } : { node : RunEvent } ) {
776
+ function NodeStatusIcon ( { node } : { node : TraceEvent } ) {
775
777
if ( node . data . level !== "TRACE" ) return null ;
776
778
if ( node . data . style . variant !== "primary" ) return null ;
777
779
@@ -896,7 +898,7 @@ function SpanWithDuration({
896
898
showDuration,
897
899
node,
898
900
...props
899
- } : Timeline . SpanProps & { node : RunEvent ; showDuration : boolean } ) {
901
+ } : Timeline . SpanProps & { node : TraceEvent ; showDuration : boolean } ) {
900
902
return (
901
903
< Timeline . Span { ...props } >
902
904
< motion . div
0 commit comments