mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-06 23:49:41 +02:00
perf: add event debouncing to InnerLoopTracker
- Add EVENT_DEBOUNCE_MS constant (50ms) for batching rapid updates - Add debounce timers and pending flags for todo/loop updates - Add emitTodoUpdateDebounced() and emitLoopUpdateDebounced() methods - Add flushPendingEvents() for testing/immediate sync needs - Update reset()/fullReset() to clear debounce timers - Replace rapid-fire emit calls with debounced versions - Reduces UI jitter from rapid consecutive updates - Tests updated to use flushPendingEvents() for synchronous testing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -205,6 +205,7 @@ describe('InnerLoopTracker', () => {
|
||||
tracker.on('todoUpdate', todoHandler);
|
||||
|
||||
tracker.processTerminalData('- [ ] First task\n');
|
||||
tracker.flushPendingEvents(); // Flush debounced events
|
||||
|
||||
expect(todoHandler).toHaveBeenCalled();
|
||||
const todos = tracker.todos;
|
||||
@@ -380,7 +381,9 @@ describe('InnerLoopTracker', () => {
|
||||
tracker.on('todoUpdate', todoHandler);
|
||||
|
||||
tracker.processTerminalData('- [ ] Task 1\n');
|
||||
tracker.flushPendingEvents(); // Flush debounced events
|
||||
tracker.processTerminalData('- [ ] Task 2\n');
|
||||
tracker.flushPendingEvents(); // Flush debounced events
|
||||
|
||||
expect(todoHandler).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user