Skip to content

Commit 85659bc

Browse files
authored
fix: only warn about deprecated introspectSchema once (#5023)
* fix: only warn about deprecated `introspectSchema` once * changeset
1 parent 58a9882 commit 85659bc

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.changeset/five-phones-pretend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-tools/wrap': patch
3+
---
4+
5+
Only warn about deprecated `introspectSchema` once

packages/wrap/src/introspect.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,15 @@ export type SchemaFromExecutorOptions = Partial<IntrospectionOptions> &
4646
Parameters<typeof buildClientSchema>[1] &
4747
ParseOptions;
4848

49+
let hasWarned = false;
50+
4951
export const introspectSchema = function introspectSchema(...args) {
50-
console.warn(
51-
`\`introspectSchema\` is deprecated, and will be removed in the next major. Please use \`schemaFromExecutor\` instead.`
52-
);
52+
if (!hasWarned) {
53+
hasWarned = true;
54+
console.warn(
55+
`\`introspectSchema\` is deprecated, and will be removed in the next major. Please use \`schemaFromExecutor\` instead.`
56+
);
57+
}
5358
return schemaFromExecutor(...(args as Parameters<typeof schemaFromExecutor>));
5459
} as typeof schemaFromExecutor;
5560

0 commit comments

Comments
 (0)