@graphql-hive/yoga 0.44.0-alpha-20251125135852-d7b3cecd21aff5daa4f54bcfaefa5ec2e1cb0958 → 0.44.0-alpha-20251125154232-c148d50d18ab71200e91e45b4b58169fd219b272

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/cjs/index.js CHANGED
@@ -23,9 +23,15 @@ function useHive(clientOrOptions) {
23
23
  const contextualCache = new WeakMap();
24
24
  let hive;
25
25
  let yoga;
26
+ let onYogaInit;
27
+ let onYogaInitDefered = new Promise(res => (onYogaInit = () => {
28
+ res();
29
+ onYogaInitDefered = null;
30
+ }));
26
31
  return {
27
32
  onYogaInit(payload) {
28
33
  yoga = payload.yoga;
34
+ onYogaInit();
29
35
  },
30
36
  onSchemaChange({ schema }) {
31
37
  hive.reportSchema({ schema });
@@ -129,7 +135,16 @@ function useHive(clientOrOptions) {
129
135
  {
130
136
  write(level, attrs, msg) {
131
137
  level = level === 'trace' ? 'debug' : level;
132
- yoga.logger[level](msg, attrs);
138
+ if (!onYogaInitDefered) {
139
+ yoga.logger[level](msg, attrs);
140
+ return;
141
+ }
142
+ // Defer logs until yoga instance is initialized
143
+ // Ideally, onPluginInit would provide us access to the logger instance
144
+ // See https://github.com/graphql-hive/graphql-yoga/issues/4048#issuecomment-3576258603
145
+ onYogaInitDefered.then(() => {
146
+ yoga === null || yoga === void 0 ? void 0 : yoga.logger[level](msg, attrs);
147
+ });
133
148
  },
134
149
  },
135
150
  ],
package/cjs/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = '0.44.0-alpha-20251125135852-d7b3cecd21aff5daa4f54bcfaefa5ec2e1cb0958';
4
+ exports.version = '0.44.0-alpha-20251125154232-c148d50d18ab71200e91e45b4b58169fd219b272';
package/esm/index.js CHANGED
@@ -14,9 +14,15 @@ export function useHive(clientOrOptions) {
14
14
  const contextualCache = new WeakMap();
15
15
  let hive;
16
16
  let yoga;
17
+ let onYogaInit;
18
+ let onYogaInitDefered = new Promise(res => (onYogaInit = () => {
19
+ res();
20
+ onYogaInitDefered = null;
21
+ }));
17
22
  return {
18
23
  onYogaInit(payload) {
19
24
  yoga = payload.yoga;
25
+ onYogaInit();
20
26
  },
21
27
  onSchemaChange({ schema }) {
22
28
  hive.reportSchema({ schema });
@@ -120,7 +126,16 @@ export function useHive(clientOrOptions) {
120
126
  {
121
127
  write(level, attrs, msg) {
122
128
  level = level === 'trace' ? 'debug' : level;
123
- yoga.logger[level](msg, attrs);
129
+ if (!onYogaInitDefered) {
130
+ yoga.logger[level](msg, attrs);
131
+ return;
132
+ }
133
+ // Defer logs until yoga instance is initialized
134
+ // Ideally, onPluginInit would provide us access to the logger instance
135
+ // See https://github.com/graphql-hive/graphql-yoga/issues/4048#issuecomment-3576258603
136
+ onYogaInitDefered.then(() => {
137
+ yoga === null || yoga === void 0 ? void 0 : yoga.logger[level](msg, attrs);
138
+ });
124
139
  },
125
140
  },
126
141
  ],
package/esm/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.44.0-alpha-20251125135852-d7b3cecd21aff5daa4f54bcfaefa5ec2e1cb0958';
1
+ export const version = '0.44.0-alpha-20251125154232-c148d50d18ab71200e91e45b4b58169fd219b272';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-hive/yoga",
3
- "version": "0.44.0-alpha-20251125135852-d7b3cecd21aff5daa4f54bcfaefa5ec2e1cb0958",
3
+ "version": "0.44.0-alpha-20251125154232-c148d50d18ab71200e91e45b4b58169fd219b272",
4
4
  "description": "GraphQL Hive + GraphQL Yoga",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -10,7 +10,7 @@
10
10
  "dependencies": {
11
11
  "@graphql-hive/logger": "^1.0.9",
12
12
  "@graphql-yoga/plugin-persisted-operations": "^3.9.0",
13
- "@graphql-hive/core": "0.16.0-alpha-20251125135852-d7b3cecd21aff5daa4f54bcfaefa5ec2e1cb0958"
13
+ "@graphql-hive/core": "0.16.0-alpha-20251125154232-c148d50d18ab71200e91e45b4b58169fd219b272"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -1,2 +1,2 @@
1
- export declare const version = "0.44.0-alpha-20251125135852-d7b3cecd21aff5daa4f54bcfaefa5ec2e1cb0958";
1
+ export declare const version = "0.44.0-alpha-20251125154232-c148d50d18ab71200e91e45b4b58169fd219b272";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const version = "0.44.0-alpha-20251125135852-d7b3cecd21aff5daa4f54bcfaefa5ec2e1cb0958";
1
+ export declare const version = "0.44.0-alpha-20251125154232-c148d50d18ab71200e91e45b4b58169fd219b272";
2
2
  //# sourceMappingURL=version.d.ts.map