mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix(app): stop the quick switcher list rebuilding while you navigate (#1881)
This commit is contained in:
1 parent
9b3dc19037
commit
76ce060d13
3 files changed
+142
-27
No files matched your search
@@ -2,6 +2,31 @@
|
||||
|
||||
import type {QuickSwitcherResult} from '@app/features/search/state/QuickSwitcherTypes';
|
||||
|
||||
function getResultSubtitle(result: QuickSwitcherResult): string | undefined {
|
||||
return 'subtitle' in result ? result.subtitle : undefined;
|
||||
}
|
||||
|
||||
export function hasSameResultIdentity(
|
||||
previous: ReadonlyArray<QuickSwitcherResult>,
|
||||
next: ReadonlyArray<QuickSwitcherResult>,
|
||||
): boolean {
|
||||
if (previous.length !== next.length) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < previous.length; i += 1) {
|
||||
if (previous[i].type !== next[i].type || previous[i].id !== next[i].id) {
|
||||
return false;
|
||||
}
|
||||
if (previous[i].title !== next[i].title) {
|
||||
return false;
|
||||
}
|
||||
if (getResultSubtitle(previous[i]) !== getResultSubtitle(next[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function resolveRecomputedSelectedIndex(
|
||||
previous: QuickSwitcherResult | undefined,
|
||||
results: ReadonlyArray<QuickSwitcherResult>,
|
||||
|
||||
Reference in new issue
Block a user