UNPKG

@shopify/shop-minis-react

Version:

React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)

38 lines (37 loc) 972 B
import { useCallback as y } from "react"; import { useQuery as d } from "../../shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js"; import { useShopMinisQueryClient as p } from "./queryClient.js"; function k(t, o, a, n) { const { skip: i = !1 } = n ?? {}, s = p(), { data: u, error: c, isLoading: l, refetch: r } = d( { queryKey: t, queryFn: async () => { const e = await o(a); if (!e.ok) throw e.error; return e.data.data; }, enabled: !i // Caching disabled by default (handled by Apollo) // fetchPolicy param is passed through to the action (Apollo layer) }, s ), f = y(async () => { await r(); }, [r]); return { data: u ?? null, loading: l, error: c, refetch: f }; } export { k as useShopActionQuery }; //# sourceMappingURL=useShopActionQuery.js.map