test(housekeeping): prove 137 route parity
This commit is contained in:
1 parent
b235ce08ff
commit
8a31556d51
36 files changed
+431
-77
No files matched your search
@@ -8,7 +8,6 @@ import {
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { executeHousekeepingSearch } from "@/actions/housekeeping-search";
|
||||
import {
|
||||
Command,
|
||||
CommandEmpty,
|
||||
@@ -40,6 +39,10 @@ export interface CommandDeckLabels {
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
export type HousekeepingSearchExecutor = (
|
||||
term: string,
|
||||
) => Promise<HousekeepingSearchResponse>;
|
||||
|
||||
type CommandDeckHit =
|
||||
| HousekeepingNavigationHit
|
||||
| HousekeepingCommandHit
|
||||
@@ -139,9 +142,11 @@ export function flattenHousekeepingSearchResults(
|
||||
|
||||
export function CommandDeck({
|
||||
labels,
|
||||
search,
|
||||
surface,
|
||||
}: {
|
||||
readonly labels: CommandDeckLabels;
|
||||
readonly search: HousekeepingSearchExecutor;
|
||||
readonly surface: HousekeepingSurface;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -189,7 +194,7 @@ export function CommandDeck({
|
||||
let active = true;
|
||||
setLoading(true);
|
||||
const timer = setTimeout(() => {
|
||||
executeHousekeepingSearch(term)
|
||||
search(term)
|
||||
.then((nextResponse) => {
|
||||
if (active && sequence === requestSequence.current) {
|
||||
setResponse(nextResponse);
|
||||
@@ -212,7 +217,7 @@ export function CommandDeck({
|
||||
active = false;
|
||||
clearTimeout(timer);
|
||||
};
|
||||
}, [open, term]);
|
||||
}, [open, search, term]);
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedIndex(entries.length === 0 ? -1 : 0);
|
||||
|
||||
Reference in new issue
Block a user