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

View File

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