Open History to see the last commit
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 const entries = useMemo(
13 () => state.entries.map((entry) => ({ path: entry.path, kind: entry.kind })),
14 [state.entries],
15 );
16 return {
17 entries,
18 error: state.error,
19 isPending: state.isPending,
20 };
21}