@octanejs/apollo-client 0.1.49 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/apollo-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.50",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"react-dom": "19.2.7",
|
|
75
75
|
"rxjs": "^7.8.2",
|
|
76
76
|
"vitest": "^4.1.10",
|
|
77
|
-
"octane": "0.4.
|
|
77
|
+
"octane": "0.4.3"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"test": "vitest run --root ../.. --project apollo-client"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createContext } from 'octane';
|
|
2
2
|
import { invariant } from '@apollo/client/utilities/invariant';
|
|
3
3
|
// To make sure Apollo Client doesn't create more than one React context
|
|
4
4
|
// (which can lead to problems like having an Apollo Client instance added
|
|
@@ -6,11 +6,15 @@ import { invariant } from '@apollo/client/utilities/invariant';
|
|
|
6
6
|
// context), a single Apollo context is created and tracked in global state.
|
|
7
7
|
const contextKey = Symbol.for('__APOLLO_CONTEXT__');
|
|
8
8
|
export function getApolloContext() {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// DEVIATION: upstream checks `'createContext' in React` on the namespace
|
|
10
|
+
// import. An `in` test forces bundlers to materialize the whole `octane`
|
|
11
|
+
// namespace object, retaining every public export; a named import keeps the
|
|
12
|
+
// same guard tree-shakeable.
|
|
13
|
+
invariant(typeof createContext === 'function', 37);
|
|
14
|
+
let context = createContext[contextKey];
|
|
11
15
|
if (!context) {
|
|
12
|
-
Object.defineProperty(
|
|
13
|
-
value: (context =
|
|
16
|
+
Object.defineProperty(createContext, contextKey, {
|
|
17
|
+
value: (context = createContext({})),
|
|
14
18
|
enumerable: false,
|
|
15
19
|
writable: false,
|
|
16
20
|
configurable: true,
|