UNPKG

2.36 kBSource Map (JSON)View Raw
1{"version":3,"file":"react.cjs","sources":["query-preloader/createQueryPreloader.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { InternalQueryReference, wrapQueryRef } from \"../internal/index.js\";\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n * @alpha\n */\nexport function createQueryPreloader(client) {\n return function preloadQuery(query, options) {\n var _a, _b;\n if (options === void 0) { options = Object.create(null); }\n var queryRef = new InternalQueryReference(client.watchQuery(__assign(__assign({}, options), { query: query })), {\n autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs,\n });\n return wrapQueryRef(queryRef);\n };\n}\n//# sourceMappingURL=createQueryPreloader.js.map"],"names":["InternalQueryReference","__assign","wrapQueryRef"],"mappings":";;;;;;;;;;;AAqBO,SAAS,oBAAoB,CAAC,MAAM,EAAE;AAC7C,IAAI,OAAO,SAAS,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE;AACjD,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC;AACnB,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;AAClE,QAAQ,IAAI,QAAQ,GAAG,IAAIA,+BAAsB,CAAC,MAAM,CAAC,UAAU,CAACC,cAAQ,CAACA,cAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE;AACxH,YAAY,oBAAoB,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,oBAAoB;AACzL,SAAS,CAAC,CAAC;AACX,QAAQ,OAAOC,qBAAY,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK,CAAC;AACN;;;;;;;;;;;;;;"}
\No newline at end of file