Skip to content

Commit 16fdd6a

Browse files
authored
upd (#4004)
1 parent 0c8e390 commit 16fdd6a

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

.changeset/shy-keys-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphiql/plugin-doc-explorer': patch
3+
---
4+
5+
show spinner in doc explorer based on `isIntrospecting` value, and not based on `isFetching`

packages/graphiql-plugin-doc-explorer/src/components/__tests__/doc-explorer.spec.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ function makeSchema(fieldName = 'field') {
4141
}
4242

4343
const defaultSchemaContext = {
44-
fetchError: null,
4544
introspect() {},
46-
isFetching: false,
4745
schema: makeSchema(),
4846
validationErrors: [],
4947
};
@@ -69,7 +67,7 @@ describe('DocExplorer', () => {
6967

7068
it('renders spinner when the schema is loading', () => {
7169
useGraphiQL.mockImplementation(cb =>
72-
cb({ ...defaultSchemaContext, isFetching: true }),
70+
cb({ ...defaultSchemaContext, isIntrospecting: true }),
7371
);
7472
const { container } = render(<DocExplorerWithContext />);
7573
const spinner = container.querySelectorAll('.graphiql-spinner');

packages/graphiql-plugin-doc-explorer/src/components/doc-explorer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { TypeDocumentation } from './type-documentation';
99
import './doc-explorer.css';
1010

1111
export const DocExplorer: FC = () => {
12-
const { fetchError, isFetching, schema, validationErrors } = useGraphiQL(
13-
pick('fetchError', 'isFetching', 'schema', 'validationErrors'),
12+
const { fetchError, isIntrospecting, schema, validationErrors } = useGraphiQL(
13+
pick('fetchError', 'isIntrospecting', 'schema', 'validationErrors'),
1414
);
1515
const explorerNavStack = useDocExplorer();
1616
const { pop } = useDocExplorerActions();
@@ -27,7 +27,7 @@ export const DocExplorer: FC = () => {
2727
Schema is invalid: {validationErrors[0].message}
2828
</div>
2929
);
30-
} else if (isFetching) {
30+
} else if (isIntrospecting) {
3131
// Schema is undefined when it is being loaded via introspection.
3232
content = <Spinner />;
3333
} else if (!schema) {

0 commit comments

Comments
 (0)