diff --git a/apps/ui/src/components/nodes/Code.tsx b/apps/ui/src/components/nodes/Code.tsx index 0503dfe2..59e2998d 100644 --- a/apps/ui/src/components/nodes/Code.tsx +++ b/apps/ui/src/components/nodes/Code.tsx @@ -73,7 +73,7 @@ function Timer({ lastExecutedAt }) { padding: "5px", }} > - Last run: {timeDifference(new Date(), lastExecutedAt)} + Last run: {timeDifference(new Date(), new Date(lastExecutedAt))} ); } diff --git a/apps/ui/src/lib/store/podSlice.ts b/apps/ui/src/lib/store/podSlice.ts index 40e9267f..7cfb45fa 100644 --- a/apps/ui/src/lib/store/podSlice.ts +++ b/apps/ui/src/lib/store/podSlice.ts @@ -1,24 +1,8 @@ import { createStore, StateCreator, StoreApi } from "zustand"; import { produce } from "immer"; -import * as Y from "yjs"; - import { Pod, MyState } from "."; -type PodResult = { - exec_count?: number; - last_exec_end?: boolean; - result: { - type?: string; - html?: string; - text?: string; - image?: string; - }[]; - running?: boolean; - lastExecutedAt?: Date; - error?: { ename: string; evalue: string; stacktrace: string[] } | null; -}; - export interface PodSlice { // local reactive variable for pod result podNames: Record; diff --git a/apps/ui/src/lib/store/runtimeSlice.ts b/apps/ui/src/lib/store/runtimeSlice.ts index 215dd973..c6c6967f 100644 --- a/apps/ui/src/lib/store/runtimeSlice.ts +++ b/apps/ui/src/lib/store/runtimeSlice.ts @@ -160,7 +160,6 @@ export type RuntimeInfo = { type PodResult = { exec_count?: number; - last_exec_end?: boolean; data: { type: string; html?: string; @@ -168,7 +167,7 @@ type PodResult = { image?: string; }[]; running?: boolean; - lastExecutedAt?: Date; + lastExecutedAt?: number; error?: { ename: string; evalue: string; stacktrace: string[] } | null; }; diff --git a/apps/yjs/src/yjs-runtime.ts b/apps/yjs/src/yjs-runtime.ts index 432dba43..e3047940 100644 --- a/apps/yjs/src/yjs-runtime.ts +++ b/apps/yjs/src/yjs-runtime.ts @@ -5,7 +5,6 @@ import { spawnRuntime, killRuntime } from "./runtime"; type PodResult = { exec_count?: number; - last_exec_end?: boolean; data: { type: string; html?: string; @@ -13,7 +12,7 @@ type PodResult = { image?: string; }[]; running?: boolean; - lastExecutedAt?: Date; + lastExecutedAt?: number; error?: { ename: string; evalue: string; stacktrace: string[] } | null; }; @@ -111,7 +110,7 @@ export async function setupRuntimeSocket({ let { podId, result, count } = payload; const oldresult: PodResult = resultMap.get(podId) || { data: [] }; oldresult.running = false; - oldresult.lastExecutedAt = new Date(); + oldresult.lastExecutedAt = Date.now(); oldresult.exec_count = count; resultMap.set(podId, oldresult); }