fix(execution-store): allowed for multiple concurrent block executions

This commit is contained in:
Emir Karabeg
2025-02-16 00:49:23 -08:00
parent 6896f74579
commit dc85adc444
3 changed files with 85 additions and 84 deletions

View File

@@ -1,25 +1,25 @@
import { create } from 'zustand'
interface ExecutionState {
activeBlockId: string | null
activeBlockIds: Set<string>
isExecuting: boolean
}
interface ExecutionActions {
setActiveBlock: (blockId: string | null) => void
setActiveBlocks: (blockIds: Set<string>) => void
setIsExecuting: (isExecuting: boolean) => void
reset: () => void
}
const initialState: ExecutionState = {
activeBlockId: null,
activeBlockIds: new Set(),
isExecuting: false,
}
export const useExecutionStore = create<ExecutionState & ExecutionActions>()((set) => ({
...initialState,
setActiveBlock: (blockId) => set({ activeBlockId: blockId }),
setActiveBlocks: (blockIds) => set({ activeBlockIds: new Set(blockIds) }),
setIsExecuting: (isExecuting) => set({ isExecuting }),
reset: () => set(initialState),
}))