feat: bundle ID migration + gitea#2 task-cache fix (recovered from fix/task-cache-unification) #4
@@ -667,9 +667,15 @@ object APILayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Atomically creates 1-50 tasks via POST /api/tasks/bulk/. The whole
|
* Atomically creates 1-50 tasks via POST /api/tasks/bulk/. The whole
|
||||||
* batch succeeds or fails together on the server. On success, every
|
* batch succeeds or fails together on the server. On success, force-
|
||||||
* returned task is merged into DataManager.allTasks so observing views
|
* refreshes _allTasks from the server — the server is the
|
||||||
* render the new batch immediately.
|
* authoritative kanban categorizer, and a single round-trip
|
||||||
|
* eliminates any drift between the per-task `kanbanColumn` hint and
|
||||||
|
* the global kanban view.
|
||||||
|
*
|
||||||
|
* This is the bug-class fix for gitea#2: the previous per-task
|
||||||
|
* updateTask loop was a no-op when _allTasks was null (fresh launch
|
||||||
|
* after onboarding), silently dropping the new tasks from cache.
|
||||||
*/
|
*/
|
||||||
suspend fun bulkCreateTasks(request: BulkCreateTasksRequest): ApiResult<BulkCreateTasksResponse> {
|
suspend fun bulkCreateTasks(request: BulkCreateTasksRequest): ApiResult<BulkCreateTasksResponse> {
|
||||||
val token = getToken() ?: return ApiResult.Error("Not authenticated", 401)
|
val token = getToken() ?: return ApiResult.Error("Not authenticated", 401)
|
||||||
@@ -677,7 +683,9 @@ object APILayer {
|
|||||||
|
|
||||||
if (result is ApiResult.Success) {
|
if (result is ApiResult.Success) {
|
||||||
DataManager.setTotalSummary(result.data.summary)
|
DataManager.setTotalSummary(result.data.summary)
|
||||||
result.data.tasks.forEach { DataManager.updateTask(it) }
|
// Authoritative refresh — replaces any placeholder kanban
|
||||||
|
// shell from updateTask with proper server data.
|
||||||
|
getTasks(forceRefresh = true)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user