Skip to content

Commit 496614c

Browse files
committed
Fixes #915 #932
1 parent 702fd3e commit 496614c

File tree

3 files changed

+46
-42
lines changed

3 files changed

+46
-42
lines changed

packages/graphql-playground-react/src/components/Playground/DocExplorer/FieldDoc.tsx

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -108,49 +108,52 @@ export default class FieldDoc extends React.Component<Props, State> {
108108
/>
109109
)}
110110

111-
{obj.fields.length > 0 && (
112-
<DocTypeSchema
113-
type={type}
114-
fields={obj.fields}
115-
interfaces={obj.interfaces}
116-
level={level}
117-
sessionId={this.props.sessionId}
118-
/>
119-
)}
111+
{obj.fields &&
112+
obj.fields.length > 0 && (
113+
<DocTypeSchema
114+
type={type}
115+
fields={obj.fields}
116+
interfaces={obj.interfaces}
117+
level={level}
118+
sessionId={this.props.sessionId}
119+
/>
120+
)}
120121

121-
{obj.args.length > 0 && (
122-
<div>
123-
<CategoryTitle>arguments</CategoryTitle>
124-
{obj.args.map((arg, index) => (
125-
<div key={arg.name}>
126-
<div>
127-
<Argument
128-
arg={arg}
129-
x={level}
130-
y={index + argsOffset}
131-
sessionId={this.props.sessionId}
132-
/>
122+
{obj.args &&
123+
obj.args.length > 0 && (
124+
<div>
125+
<CategoryTitle>arguments</CategoryTitle>
126+
{obj.args.map((arg, index) => (
127+
<div key={arg.name}>
128+
<div>
129+
<Argument
130+
arg={arg}
131+
x={level}
132+
y={index + argsOffset}
133+
sessionId={this.props.sessionId}
134+
/>
135+
</div>
133136
</div>
134-
</div>
135-
))}
136-
</div>
137-
)}
137+
))}
138+
</div>
139+
)}
138140

139-
{obj.implementations.length > 0 && (
140-
<div>
141-
<CategoryTitle>implementations</CategoryTitle>
142-
{obj.implementations.map((data, index) => (
143-
<TypeLink
144-
key={data.name}
145-
type={data}
146-
x={level}
147-
y={index + implementationsOffset}
148-
collapsable={true}
149-
lastActive={false}
150-
/>
151-
))}
152-
</div>
153-
)}
141+
{obj.implementations &&
142+
obj.implementations.length > 0 && (
143+
<div>
144+
<CategoryTitle>implementations</CategoryTitle>
145+
{obj.implementations.map((data, index) => (
146+
<TypeLink
147+
key={data.name}
148+
type={data}
149+
x={level}
150+
y={index + implementationsOffset}
151+
collapsable={true}
152+
lastActive={false}
153+
/>
154+
))}
155+
</div>
156+
)}
154157
</div>
155158
)
156159
}

packages/graphql-playground-react/src/components/Playground/ExplorerTabs/SideTabs.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ const TabContentContainer = styled.div`
340340
letter-spacing: 0.3px;
341341
box-shadow: -1px 1px 6px 0 rgba(0, 0, 0, 0.3);
342342
outline: none;
343-
user-select: none;
344343
&::before {
345344
top: 0;
346345
bottom: 0;

packages/graphql-playground-react/src/components/Playground/GraphQLEditor.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ class GraphQLEditor extends React.PureComponent<Props & ReduxProps> {
332332
}
333333

334334
handleClickReference = reference => {
335-
this.docExplorerComponent.showDocFromType(reference.field || reference)
335+
if (this.docExplorerComponent) {
336+
this.docExplorerComponent.showDocFromType(reference.field || reference)
337+
}
336338
}
337339

338340
/**

0 commit comments

Comments
 (0)