mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-11 20:27:44 +02:00
[aidan] fix/workflows: optimistically apply edits so the schedule banner updates instantly
This commit is contained in:
@@ -593,6 +593,16 @@ const slice = createSlice({
|
||||
})
|
||||
.addCase(fetchWorkflows.rejected, (state) => { state.loading = false; state.loaded = true; })
|
||||
.addCase(createWorkflow.fulfilled, (state, action) => { state.items[action.payload.id] = action.payload; })
|
||||
// Optimistic: reflect the patch in the store immediately so store-driven
|
||||
// UI (the schedule test-first banner, status, etc.) updates the instant
|
||||
// the user edits, not after the PATCH round-trips (which awaits an aux
|
||||
// relabel LLM call server-side). fulfilled overwrites with server truth;
|
||||
// a 409 stale triggers a refetch in useWorkflowPatch.
|
||||
.addCase(updateWorkflow.pending, (state, action) => {
|
||||
const { id, patch } = action.meta.arg;
|
||||
const cur = state.items[id];
|
||||
if (cur) state.items[id] = { ...cur, ...patch };
|
||||
})
|
||||
.addCase(updateWorkflow.fulfilled, (state, action) => { state.items[action.payload.id] = action.payload; })
|
||||
.addCase(commitDraft.fulfilled, (state, action) => { state.items[action.payload.id] = action.payload; })
|
||||
.addCase(discardDraft.fulfilled, (state, action) => { state.items[action.payload.id] = action.payload; })
|
||||
|
||||
Reference in New Issue
Block a user