Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Return empty list or an unknown task when not able to fetch the expected task from the store

天舟b9b7b02db478
diff --git a/frontend/src/store/modules/task.ts b/frontend/src/store/modules/task.ts
index a71b82c39c..e108f155ea 100644
--- a/frontend/src/store/modules/task.ts
+++ b/frontend/src/store/modules/task.ts
@@ -8,6 +8,7 @@ import {
TaskState,
ResourceObject,
Principal,
+ unknown,
} from "../../types";
import principal from "./principal";
@@ -46,11 +47,11 @@ const state: () => TaskState = () => ({
const getters = {
taskListByUser: (state: TaskState) => (userId: UserId) => {
- return state.taskListByUser.get(userId);
+ return state.taskListByUser.get(userId) || [];
},
- taskById: (state: TaskState) => (taskId: TaskId) => {
- return state.taskById.get(taskId);
+ taskById: (state: TaskState) => (taskId: TaskId): Task => {
+ return state.taskById.get(taskId) || (unknown("TASK") as Task);
},
};