Skip to content

Commit 7d1a1b8

Browse files
committed
address comments
1 parent be556b9 commit 7d1a1b8

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

apps/sim/hooks/use-code-undo-redo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ export function useCodeUndoRedo({
224224

225225
useEffect(() => {
226226
return () => {
227-
clearTimer()
227+
flushPending()
228228
}
229-
}, [clearTimer])
229+
}, [flushPending])
230230

231231
return {
232232
recordChange,

apps/sim/stores/undo-redo/code-store.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ interface CodeUndoRedoState {
2525
undo: (workflowId: string, blockId: string, subBlockId: string) => CodeUndoRedoEntry | null
2626
redo: (workflowId: string, blockId: string, subBlockId: string) => CodeUndoRedoEntry | null
2727
clear: (workflowId: string, blockId: string, subBlockId: string) => void
28-
clearRedo: (workflowId: string, blockId: string, subBlockId: string) => void
29-
getStackSizes: (
30-
workflowId: string,
31-
blockId: string,
32-
subBlockId: string
33-
) => { undoSize: number; redoSize: number }
34-
reset: () => void
3528
}
3629

3730
const DEFAULT_CAPACITY = 500
@@ -143,27 +136,6 @@ export const useCodeUndoRedoStore = create<CodeUndoRedoState>()(
143136
const { [key]: _, ...rest } = state.stacks
144137
set({ stacks: rest })
145138
},
146-
clearRedo: (workflowId, blockId, subBlockId) => {
147-
const key = getStackKey(workflowId, blockId, subBlockId)
148-
const state = get()
149-
const stack = state.stacks[key]
150-
if (!stack) return
151-
set({
152-
stacks: {
153-
...state.stacks,
154-
[key]: { ...stack, redo: [], lastUpdated: Date.now() },
155-
},
156-
})
157-
},
158-
getStackSizes: (workflowId, blockId, subBlockId) => {
159-
const key = getStackKey(workflowId, blockId, subBlockId)
160-
const stack = get().stacks[key]
161-
if (!stack) return { undoSize: 0, redoSize: 0 }
162-
return { undoSize: stack.undo.length, redoSize: stack.redo.length }
163-
},
164-
reset: () => {
165-
set(initialState)
166-
},
167139
}),
168140
{
169141
name: 'code-undo-redo-store',

0 commit comments

Comments
 (0)