mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
26 lines
643 B
TypeScript
26 lines
643 B
TypeScript
import { create } from 'zustand'
|
|
|
|
interface ExecutionState {
|
|
activeBlockIds: Set<string>
|
|
isExecuting: boolean
|
|
}
|
|
|
|
interface ExecutionActions {
|
|
setActiveBlocks: (blockIds: Set<string>) => void
|
|
setIsExecuting: (isExecuting: boolean) => void
|
|
reset: () => void
|
|
}
|
|
|
|
const initialState: ExecutionState = {
|
|
activeBlockIds: new Set(),
|
|
isExecuting: false,
|
|
}
|
|
|
|
export const useExecutionStore = create<ExecutionState & ExecutionActions>()((set) => ({
|
|
...initialState,
|
|
|
|
setActiveBlocks: (blockIds) => set({ activeBlockIds: new Set(blockIds) }),
|
|
setIsExecuting: (isExecuting) => set({ isExecuting }),
|
|
reset: () => set(initialState),
|
|
}))
|