Fully rework format action (#3877)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-10-24 23:31:31 +07:00 committed by GitHub
parent e85cf1eeab
commit 56dcbeb0cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -301,8 +301,9 @@
} else {
const obj = stateObjs[statePos - 1]
if (obj !== undefined) {
if (!noScroll) scrollInto(objState, obj)
dispatch('row-focus', obj)
const focusDoc = listListCategory[objState]?.getLimited().find((it) => it._id === obj._id) ?? obj
if (!noScroll) scrollInto(objState, focusDoc)
dispatch('row-focus', focusDoc)
}
}
return
@ -321,16 +322,18 @@
} else {
const obj = stateObjs[statePos + 1]
if (obj !== undefined) {
if (!noScroll) scrollInto(objState, obj)
dispatch('row-focus', obj)
const focusDoc = listListCategory[objState]?.getLimited().find((it) => it._id === obj._id) ?? obj
if (!noScroll) scrollInto(objState, focusDoc)
dispatch('row-focus', focusDoc)
}
}
return
}
}
if (offset === 0) {
if (!noScroll) scrollInto(objState, obj)
dispatch('row-focus', obj)
const focusDoc = listListCategory[objState]?.getLimited().find((it) => it._id === obj._id) ?? obj
if (!noScroll) scrollInto(objState, focusDoc)
dispatch('row-focus', focusDoc)
}
} else {
listCategory[objState]?.select(offset, of, dir, noScroll)

View File

@ -110,6 +110,10 @@
(res) => {
items = res
loading = false
const focusDoc = items.find((it) => it._id === $focusStore.focus?._id)
if (focusDoc) {
handleRowFocused(focusDoc)
}
},
{ ...resultOptions, limit: limit ?? 200 }
)