(runs: ExecutionRun[], run: ExecutionRun)
| 139 | }; |
| 140 | |
| 141 | const upsertIntoRuns = (runs: ExecutionRun[], run: ExecutionRun) => { |
| 142 | const existingIndex = runs.findIndex((item) => item.id === run.id); |
| 143 | if (existingIndex === -1) { |
| 144 | return sortRuns([...runs, run]); |
| 145 | } |
| 146 | const updated = [...runs]; |
| 147 | updated[existingIndex] = { |
| 148 | ...updated[existingIndex], |
| 149 | ...run, |
| 150 | status: run.status, |
| 151 | }; |
| 152 | return sortRuns(updated); |
| 153 | }; |
| 154 | |
| 155 | export const useRunStore = create<RunStore>()( |
| 156 | subscribeWithSelector((set, get) => ({ |