fix(desktop): performance/jankiness
This commit is contained in:
parent
56b5cdf883
commit
5f074edc3a
7 changed files with 61 additions and 70 deletions
|
|
@ -51,9 +51,17 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
|
|||
)
|
||||
})
|
||||
|
||||
function initialActive() {
|
||||
if (props.current) return props.key(props.current)
|
||||
|
||||
const items = flat()
|
||||
if (items.length === 0) return ""
|
||||
return props.key(items[0])
|
||||
}
|
||||
|
||||
const list = createList({
|
||||
items: () => flat().map(props.key),
|
||||
initialActive: props.current ? props.key(props.current) : props.key(flat()[0]),
|
||||
initialActive: initialActive(),
|
||||
loop: true,
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue