From ddc1db1849730bfbca67b4f355c313353b587b03 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Mon, 2 Sep 2024 16:06:49 +0100 Subject: [PATCH] Undefined typre for useSyncedShape --- apps/webapp/app/hooks/useSyncTrace.ts | 2 +- apps/webapp/app/hooks/useSyncTraceRuns.ts | 3 +-- apps/webapp/app/hooks/useSyncedShape.ts | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/webapp/app/hooks/useSyncTrace.ts b/apps/webapp/app/hooks/useSyncTrace.ts index 111d5eb33..185c73fa4 100644 --- a/apps/webapp/app/hooks/useSyncTrace.ts +++ b/apps/webapp/app/hooks/useSyncTrace.ts @@ -11,7 +11,7 @@ export type Trace = ReturnType; export type TraceEvent = Trace["events"][number]; export function useSyncTrace({ origin, traceId }: Params) { - const { isUpToDate, data } = useShape({ + const { isUpToDate, data, error, isError } = useShape({ url: `${origin}/sync/traces/${traceId}`, }); diff --git a/apps/webapp/app/hooks/useSyncTraceRuns.ts b/apps/webapp/app/hooks/useSyncTraceRuns.ts index 6411b2c0d..3e3c92771 100644 --- a/apps/webapp/app/hooks/useSyncTraceRuns.ts +++ b/apps/webapp/app/hooks/useSyncTraceRuns.ts @@ -1,7 +1,6 @@ -import { useShape } from "@electric-sql/react"; +import { Prettify } from "@trigger.dev/core"; import { TaskRun } from "@trigger.dev/database"; import { SyncedShapeData, useSyncedShape } from "./useSyncedShape"; -import { Prettify } from "@trigger.dev/core"; type Params = { origin: string; diff --git a/apps/webapp/app/hooks/useSyncedShape.ts b/apps/webapp/app/hooks/useSyncedShape.ts index 93e014133..77f37990d 100644 --- a/apps/webapp/app/hooks/useSyncedShape.ts +++ b/apps/webapp/app/hooks/useSyncedShape.ts @@ -4,7 +4,7 @@ export type ShapeInput = Parameters[0]; export type ShapeOutput = { isError: boolean; isUpToDate: boolean; - data: S[]; + data: S[] | undefined; }; export type SyncedShapeData = { @@ -27,7 +27,9 @@ export function useSyncedShape(props: ShapeInput): ShapeOutput[], + data: output.data + ? (transformInput(output.data as InputObject) as SyncedShapeData[]) + : undefined, }; }