Fix a bulk of sentry errors (#6399)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-08-27 15:01:21 +07:00 committed by GitHub
parent 7324f2ef54
commit c8357246b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 32 additions and 19 deletions

View File

@ -33,7 +33,9 @@ function $push (document: Doc, keyval: Record<string, PropertyType>): void {
const arr = doc[key] as Array<any>
const desc = val as Position<PropertyType>
if ('$each' in desc) {
arr.splice(desc.$position ?? 0, 0, ...desc.$each)
if (arr != null) {
arr.splice(desc.$position ?? 0, 0, ...desc.$each)
}
} else {
arr.push(val)
}

View File

@ -367,6 +367,7 @@
name="file"
id="file"
style="display: none"
disabled={inputFile == null}
on:change={fileSelected}
/>

View File

@ -135,7 +135,7 @@
async function handleSelection (evt: Event | undefined, selection: number): Promise<void> {
const person = contacts[selection]
selected = allowDeselect && person._id === selected ? undefined : person._id
selected = allowDeselect && person?._id === selected ? undefined : person?._id
dispatch('close', selected !== undefined ? person : undefined)
}

View File

@ -63,9 +63,11 @@ const $documentAllVersions = createStore<ControlledDocument[]>([])
.on(documentAllVersionsUpdated, (_, payload) => payload)
.reset(controlledDocumentClosed)
export const $documentAllVersionsDescSorted = $documentAllVersions.map((docs) =>
docs.toSorted((a, b) => documentCompareFn(a, b) * -1)
)
export const $documentAllVersionsDescSorted = $documentAllVersions.map((docs) => {
const result = [...docs]
result.sort((a, b) => documentCompareFn(a, b) * -1)
return result
})
export const $documentSnapshots = createStore<ControlledDocumentSnapshot[]>([])
.on(documentSnapshotsUpdated, (_, payload) => payload)

View File

@ -216,11 +216,13 @@
tasks: new Map()
}
const tsk = r.$lookup?.attachedTo as Issue
newMap.set(r.employee, {
value: or.value + r.value,
reports: [...or.reports, r],
tasks: or.tasks.set(tsk._id, tsk)
})
if (tsk !== undefined) {
newMap.set(r.employee, {
value: or.value + r.value,
reports: [...or.reports, r],
tasks: or.tasks.set(tsk._id, tsk)
})
}
}
}
timeReports = newMap

View File

@ -42,7 +42,7 @@
let loading2: boolean = false
$: {
loading1 = true
getClient()
void getClient()
.findAll(tags.class.TagCategory, { targetClass })
.then((result) => {
categories = result
@ -52,14 +52,15 @@
$: {
loading2 = true
getClient()
void getClient()
.findAll(
tags.class.TagElement,
{ category: { $in: Array.from(categories.map((it) => it._id)) } },
{ sort: { title: 1 } }
)
.then((res) => {
elements = res.toSorted((a, b) => prepareTitle(a.title).localeCompare(prepareTitle(b.title)))
res.sort((a, b) => prepareTitle(a.title).localeCompare(prepareTitle(b.title)))
elements = res
loading2 = false
})
}
@ -157,7 +158,7 @@
let titles: string[] = []
const titlesStates = new Map<string, boolean>()
$: getClient()
$: void getClient()
.findAll(
tags.class.TagReference,
{
@ -427,7 +428,7 @@
doProcessing = true
if (elements.length > 0 && expertRefs.length > 0) {
setTimeout(() => {
updateTagsList(
void updateTagsList(
elements,
expertRefs.filter((it) => titlesStates.get(prepareTitle(it.title.toLowerCase())) ?? true)
).then(() => {

View File

@ -120,8 +120,10 @@
}
const handleSelect = async (event: CustomEvent): Promise<void> => {
selected = event.detail as AnyAttribute
const exist = (await client.findOne(selected.attributeOf, { [selected.name]: { $exists: true } })) !== undefined
$settingsStore = { id: selected._id, component: EditAttribute, props: { attribute: selected, exist, disabled } }
if (selected != null) {
const exist = (await client.findOne(selected.attributeOf, { [selected.name]: { $exists: true } })) !== undefined
$settingsStore = { id: selected._id, component: EditAttribute, props: { attribute: selected, exist, disabled } }
}
}
onDestroy(() => {
if (selected !== undefined) clearSettingsStore()

View File

@ -15,7 +15,8 @@
tracker.class.RelatedIssueTarget,
{},
(res) => {
targets = res.toSorted((a, b) => a.rule.kind.localeCompare(b.rule.kind))
res.sort((a, b) => a.rule.kind.localeCompare(b.rule.kind))
targets = res
},
{
lookup: {

View File

@ -69,7 +69,9 @@
{ _id },
async (result) => {
;[template] = result
title = template.title
if (template != null) {
title = template.title
}
currentProject = template.$lookup?.space
},
{ lookup: { space: tracker.class.Project, labels: tags.class.TagElement } }