rename CacheService to StateManager (#5681)

* rename CacheService to StateManager

* fix types
This commit is contained in:
celestial-vault authored and Saoud Rizwan committed 2025-08-26 15:24:17 -07:00
1 parent 2fbebec7ae
commit bd526cb2d2
42 files changed
+240 -232

No files matched your search

@@ -18,7 +18,7 @@ export async function deleteAllTaskHistory(controller: Controller): Promise<Dele
await controller.clearTask()
// Get existing task history
const taskHistory = controller.cacheService.getGlobalStateKey("taskHistory")
const taskHistory = controller.stateManager.getGlobalStateKey("taskHistory")
const totalTasks = taskHistory.length
const userChoice = (
@@ -47,7 +47,7 @@ export async function deleteAllTaskHistory(controller: Controller): Promise<Dele
// If there are favorited tasks, update state
if (favoritedTasks.length > 0) {
controller.cacheService.setGlobalState("taskHistory", favoritedTasks)
controller.stateManager.setGlobalState("taskHistory", favoritedTasks)
// Delete non-favorited task directories
const preserveTaskIds = favoritedTasks.map((task) => task.id)
@@ -87,7 +87,7 @@ export async function deleteAllTaskHistory(controller: Controller): Promise<Dele
}
// Delete everything (not preserving favorites)
controller.cacheService.setGlobalState("taskHistory", [])
controller.stateManager.setGlobalState("taskHistory", [])
try {
// Remove all contents of tasks directory
+1 -1
View File
@@ -13,7 +13,7 @@ export async function getTaskHistory(controller: Controller, request: GetTaskHis
const { favoritesOnly, currentWorkspaceOnly, searchQuery, sortBy } = request
// Get task history from global state
const taskHistory = controller.cacheService.getGlobalStateKey("taskHistory")
const taskHistory = controller.stateManager.getGlobalStateKey("taskHistory")
const workspacePath = await getWorkspacePath()
// Apply filters
+1 -1
View File
@@ -14,7 +14,7 @@ export async function showTaskWithId(controller: Controller, request: StringRequ
const id = request.value
// First check if task exists in global state for faster access
const taskHistory = controller.cacheService.getGlobalStateKey("taskHistory")
const taskHistory = controller.stateManager.getGlobalStateKey("taskHistory")
const historyItem = taskHistory.find((item) => item.id === id)
// We need to initialize the task before returning data
@@ -12,7 +12,7 @@ export async function toggleTaskFavorite(controller: Controller, request: TaskFa
try {
// Update in-memory state only
try {
const history = controller.cacheService.getGlobalStateKey("taskHistory")
const history = controller.stateManager.getGlobalStateKey("taskHistory")
const taskIndex = history.findIndex((item) => item.id === request.taskId)
@@ -28,7 +28,7 @@ export async function toggleTaskFavorite(controller: Controller, request: TaskFa
// Update global state and wait for it to complete
try {
controller.cacheService.setGlobalState("taskHistory", updatedHistory)
controller.stateManager.setGlobalState("taskHistory", updatedHistory)
} catch (stateErr) {
console.error("Error updating global state:", stateErr)
}