UBER-293 inbox selection fix (#3287)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2023-05-30 18:05:17 +07:00
committed by GitHub
parent c51cbaffa0
commit b9d8a7a6e5
3 changed files with 25 additions and 6 deletions
@@ -62,8 +62,13 @@
listProvider.update(filtered)
if (loading || _id === undefined) {
changeSelected(selected)
} else if (filtered.find((p) => p.attachedTo === _id) === undefined) {
changeSelected(selected)
} else {
const index = filtered.findIndex((p) => p.attachedTo === _id)
if (index === -1) {
changeSelected(selected)
} else {
selected = index
}
}
}
@@ -58,8 +58,13 @@
listProvider.update(docs)
if (loading || _id === undefined) {
changeSelected(selected)
} else if (docs.find((p) => p.attachedTo === _id) === undefined) {
changeSelected(selected)
} else {
const index = docs.findIndex((p) => p.attachedTo === _id)
if (index === -1) {
changeSelected(selected)
} else {
selected = index
}
}
loading = false
},
@@ -92,8 +92,17 @@
.filter((p) => p !== undefined) as EmployeeAccount[]
if (loading || _id === undefined) {
changeSelected(selected)
} else if (filtered.find((p) => p.attachedTo === _id) === undefined) {
changeSelected(selected)
} else {
const index = filtered.findIndex((p) => p.attachedTo === _id)
if (index === -1) {
changeSelected(selected)
} else {
const doc = filtered[index]
const acc = accounts.findIndex((p) => p._id === doc.txes[doc.txes.length - 1].modifiedBy)
if (acc !== -1) {
selected = acc
}
}
}
}