diff options
| author | Louis Jimenez <[email protected]> | 2025-06-11 15:33:09 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-11 15:33:09 -0400 |
| commit | e0f4f428fc6bef4f81db379ce1e0368004079c76 (patch) | |
| tree | 4f9be0dc0f8fe11de7b83c32e56bf55314de9d93 /packages/cli/src/ui/hooks/useHistoryManager.ts | |
| parent | f75c48323ce65f651381c74ae75a1795e7cc5c45 (diff) | |
Restore Checkpoint Feature (#934)
Diffstat (limited to 'packages/cli/src/ui/hooks/useHistoryManager.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useHistoryManager.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/cli/src/ui/hooks/useHistoryManager.ts b/packages/cli/src/ui/hooks/useHistoryManager.ts index f82707ef..c45ac8d3 100644 --- a/packages/cli/src/ui/hooks/useHistoryManager.ts +++ b/packages/cli/src/ui/hooks/useHistoryManager.ts @@ -20,6 +20,7 @@ export interface UseHistoryManagerReturn { updates: Partial<Omit<HistoryItem, 'id'>> | HistoryItemUpdater, ) => void; clearItems: () => void; + loadHistory: (newHistory: HistoryItem[]) => void; } /** @@ -38,6 +39,10 @@ export function useHistory(): UseHistoryManagerReturn { return baseTimestamp + messageIdCounterRef.current; }, []); + const loadHistory = useCallback((newHistory: HistoryItem[]) => { + setHistory(newHistory); + }, []); + // Adds a new item to the history state with a unique ID. const addItem = useCallback( (itemData: Omit<HistoryItem, 'id'>, baseTimestamp: number): number => { @@ -101,5 +106,6 @@ export function useHistory(): UseHistoryManagerReturn { addItem, updateItem, clearItems, + loadHistory, }; } |
