improvement(store): cleaned up deploy store

This commit is contained in:
Emir Karabeg
2025-02-28 20:29:11 -08:00
parent cad3db9cae
commit 478db6aa2e
4 changed files with 3 additions and 32 deletions
@@ -77,6 +77,7 @@ export function ControlBar() {
return () => clearInterval(interval)
}, [])
// TODO: Put this in sync-manager
// Check deployment status on mount or when activeWorkflowId changes
useEffect(() => {
async function checkStatus() {
+1 -5
View File
@@ -25,8 +25,6 @@ export const withHistory = (
blocks: initialState.blocks,
edges: initialState.edges,
loops: initialState.loops,
isDeployed: initialState.isDeployed || false,
deployedAt: initialState.deployedAt,
},
timestamp: Date.now(),
action: 'Initial state',
@@ -138,7 +136,7 @@ export const withHistory = (
history: {
past: [],
present: {
state: { blocks: {}, edges: [], loops: {}, isDeployed: false },
state: { blocks: {}, edges: [], loops: {} },
timestamp: Date.now(),
action: 'Clear workflow',
subblockValues: {},
@@ -206,8 +204,6 @@ export const createHistoryEntry = (state: WorkflowState, action: string): Histor
blocks: { ...state.blocks },
edges: [...state.edges],
loops: { ...state.loops },
isDeployed: state.isDeployed !== undefined ? state.isDeployed : false,
deployedAt: state.deployedAt,
}
// Capture the current subblock values for this workflow
-26
View File
@@ -73,8 +73,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
},
edges: [...get().edges],
loops: { ...get().loops },
isDeployed: get().isDeployed,
deployedAt: get().deployedAt,
}
set(newState)
@@ -105,8 +103,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
blocks: { ...get().blocks },
edges: [...get().edges].filter((edge) => edge.source !== id && edge.target !== id),
loops: { ...get().loops },
isDeployed: get().isDeployed || false,
deployedAt: get().deployedAt,
}
// Clean up subblock values before removing the block
@@ -199,8 +195,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
blocks: { ...get().blocks },
edges: newEdges,
loops: newLoops,
isDeployed: get().isDeployed || false,
deployedAt: get().deployedAt,
}
set(newState)
@@ -238,8 +232,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
blocks: { ...get().blocks },
edges: newEdges,
loops: newLoops,
isDeployed: get().isDeployed || false,
deployedAt: get().deployedAt,
}
set(newState)
@@ -252,8 +244,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
blocks: {},
edges: [],
loops: {},
isDeployed: false,
deployedAt: undefined,
history: {
past: [],
present: {
@@ -261,8 +251,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
blocks: {},
edges: [],
loops: {},
isDeployed: false,
deployedAt: undefined,
},
timestamp: Date.now(),
action: 'Initial state',
@@ -290,8 +278,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
},
},
edges: [...get().edges],
isDeployed: get().isDeployed || false,
deployedAt: get().deployedAt,
}
set(newState)
@@ -341,8 +327,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
},
edges: [...get().edges],
loops: { ...get().loops },
isDeployed: get().isDeployed || false,
deployedAt: get().deployedAt,
}
// Update the subblock store with the duplicated values
@@ -376,8 +360,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
},
},
edges: [...get().edges],
isDeployed: get().isDeployed || false,
deployedAt: get().deployedAt,
}
set(newState)
@@ -395,8 +377,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
},
edges: [...get().edges],
loops: { ...get().loops },
isDeployed: get().isDeployed || false,
deployedAt: get().deployedAt,
}
set(newState)
@@ -415,8 +395,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
},
edges: [...state.edges],
loops: { ...get().loops },
isDeployed: state.isDeployed || false,
deployedAt: state.deployedAt,
}))
get().updateLastSaved()
},
@@ -431,8 +409,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
},
},
edges: [...state.edges],
isDeployed: state.isDeployed || false,
deployedAt: state.deployedAt,
}))
get().updateLastSaved()
},
@@ -448,8 +424,6 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
maxIterations: Math.max(1, Math.min(50, maxIterations)), // Clamp between 1-50
},
},
isDeployed: get().isDeployed || false,
deployedAt: get().deployedAt,
}
set(newState)
+1 -1
View File
@@ -37,7 +37,7 @@ export interface WorkflowState {
lastSaved?: number
loops: Record<string, Loop>
lastUpdate?: number
isDeployed: boolean
isDeployed?: boolean
deployedAt?: Date
}