Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

composerPathSearchState.ts

22 lines689 Bytes

1import {
2 type ComposerPathSearchState,
3 type ComposerPathSearchTarget,
4} from "@t3tools/client-runtime/state/threads";
5​
6import { useMemo } from "react";
7​
8import { useComposerPathSearch as useComposerPathSearchQuery } from "../state/queries";
9​
10export function useComposerPathSearch(target: ComposerPathSearchTarget): ComposerPathSearchState {
11 const state = useComposerPathSearchQuery(target);
12 // A stable list lets the composer menu memo cache between renders.
13 const entries = useMemo(
14 () => state.entries.map((entry) => ({ path: entry.path, kind: entry.kind })),
15 [state.entries],
16 );
17 return {
18 entries,
19 error: state.error,
20 isPending: state.isPending,
21 };