diff --git a/plugins/task/src/utils.ts b/plugins/task/src/utils.ts index 67e881c9f82..69f43946385 100644 --- a/plugins/task/src/utils.ts +++ b/plugins/task/src/utils.ts @@ -114,7 +114,7 @@ export async function createState ( if (exists !== undefined) { return exists._id as Ref } - const res = await client.createDoc(_class, task.space.Statuses, data) + const res = await client.createDoc(_class, core.space.Model, data) return res } diff --git a/plugins/tracker-resources/src/components/issues/StatusEditor.svelte b/plugins/tracker-resources/src/components/issues/StatusEditor.svelte index 4f5b151870a..d3ae09c78de 100644 --- a/plugins/tracker-resources/src/components/issues/StatusEditor.svelte +++ b/plugins/tracker-resources/src/components/issues/StatusEditor.svelte @@ -96,15 +96,18 @@ return current } } + if (defaultIssueStatus !== undefined) { const res = statuses?.find((status) => status._id === defaultStatus) - void changeStatus(res?._id, false) - return res + // Might not exist for projects with multiple task types with different statuses + if (res != null) { + void changeStatus(res?._id, false) + return res + } } + // We need to choose first one, since it should not be case without status. - if (value.status === undefined) { - void changeStatus(statuses?.[0]?._id, false) - } + void changeStatus(statuses?.[0]?._id, false) } $: selectedStatus = getSelectedStatus(statuses, value, defaultIssueStatus)