Skip to content

Commit 15f7cdf

Browse files
Remove support for passing function as introspection (#318)
1 parent ae4bed2 commit 15f7cdf

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/components/Voyager.tsx

+2-15
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616

1717
import { getTypeGraph, SVGRender } from '../graph/';
1818
import { extractTypeId, getSchema } from '../introspection';
19-
import { voyagerIntrospectionQuery } from '../utils/introspection-query';
2019
import DocExplorer from './doc-explorer/DocExplorer';
2120
import GraphViewport from './GraphViewport';
2221
import { IntrospectionModal } from './IntrospectionModal';
@@ -25,8 +24,6 @@ import Settings from './settings/Settings';
2524
import PoweredBy from './utils/PoweredBy';
2625
import { VoyagerLogo } from './utils/VoyagerLogo';
2726

28-
type IntrospectionProvider = (query: string) => Promise<any>;
29-
3027
export interface VoyagerDisplayOptions {
3128
rootType?: string;
3229
skipRelay?: boolean;
@@ -46,7 +43,7 @@ const defaultDisplayOptions = {
4643
};
4744

4845
export interface VoyagerProps {
49-
introspection: IntrospectionProvider | unknown;
46+
introspection: unknown;
5047
displayOptions?: VoyagerDisplayOptions;
5148
introspectionPresets?: { [name: string]: any };
5249
allowToChangeSchema?: boolean;
@@ -66,19 +63,9 @@ export default function Voyager(props: VoyagerProps) {
6663
});
6764

6865
useEffect(() => {
69-
let introspection = props.introspection;
70-
if (typeof introspection === 'function') {
71-
console.warn(
72-
'GraphQLVoyager: Passing function as "introspection" is deprecated.' +
73-
'To access introspection query, please use "voyagerIntrospectionQuery".',
74-
);
75-
76-
introspection = introspection(voyagerIntrospectionQuery);
77-
}
78-
7966
// FIXME: handle rejection and also handle errors inside introspection
8067
// eslint-disable-next-line @typescript-eslint/no-floating-promises
81-
Promise.resolve(introspection).then(({ data }) => {
68+
Promise.resolve(props.introspection).then(({ data }) => {
8269
setIntrospectionData(data);
8370
setSelected({ typeID: null, edgeID: null });
8471
});

0 commit comments

Comments
 (0)