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

composerPathSearchState.ts

21 lines619 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 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 };