1 | import { __assign } from "tslib";
|
2 | import { invariant } from "../../utilities/globals/index.js";
|
3 | import * as React from "rehackt";
|
4 | import { getApolloContext } from "./ApolloContext.js";
|
5 | export var ApolloProvider = function (_a) {
|
6 | var client = _a.client, children = _a.children;
|
7 | var ApolloContext = getApolloContext();
|
8 | var parentContext = React.useContext(ApolloContext);
|
9 | var context = React.useMemo(function () {
|
10 | return __assign(__assign({}, parentContext), { client: client || parentContext.client });
|
11 | }, [parentContext, client]);
|
12 | invariant(context.client, 47);
|
13 | return (React.createElement(ApolloContext.Provider, { value: context }, children));
|
14 | };
|
15 |
|
\ | No newline at end of file |