import { NDKAppHandlerEvent } from "@nostr-dev-kit/ndk"; import { useQuery } from "@tanstack/react-query"; import { useArk } from "../../hooks/useArk"; export function AppHandler({ tag }: { tag: string[] }) { const ark = useArk(); const { isLoading, isError, data } = useQuery({ queryKey: ["app-handler", tag[1]], queryFn: async () => { const ref = tag[1].split(":"); const event = await ark.getEventByFilter({ filter: { kinds: [Number(ref[0])], authors: [ref[1]], "#d": [ref[2]], }, }); if (!event) return null; const app = NDKAppHandlerEvent.from(event); return await app.fetchProfile(); }, refetchOnWindowFocus: false, }); if (isLoading) {