Undefined typre for useSyncedShape
This commit is contained in:
@@ -11,7 +11,7 @@ export type Trace = ReturnType<typeof createTraceTreeFromEvents>;
|
||||
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}`,
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,7 +4,7 @@ export type ShapeInput = Parameters<typeof useShape>[0];
|
||||
export type ShapeOutput<S> = {
|
||||
isError: boolean;
|
||||
isUpToDate: boolean;
|
||||
data: S[];
|
||||
data: S[] | undefined;
|
||||
};
|
||||
|
||||
export type SyncedShapeData<T> = {
|
||||
@@ -27,7 +27,9 @@ export function useSyncedShape<S>(props: ShapeInput): ShapeOutput<SyncedShapeDat
|
||||
return {
|
||||
isError: output.isError,
|
||||
isUpToDate: output.isUpToDate,
|
||||
data: transformInput(output.data as InputObject) as SyncedShapeData<S>[],
|
||||
data: output.data
|
||||
? (transformInput(output.data as InputObject) as SyncedShapeData<S>[])
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user