Skip to content

Commit 56df94d

Browse files
committed
Hide Add <operation> button if <operation> has no fields (e.g. Gatsby's use case, with no Mutations or Subscriptions)
1 parent 0759092 commit 56df94d

1 file changed

Lines changed: 27 additions & 21 deletions

File tree

src/Explorer.js

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,27 +1680,33 @@ class Explorer extends React.PureComponent<Props, State> {
16801680
},
16811681
)}
16821682
<div className="variable-editor-title" style={explorerActionsStyle}>
1683-
<button
1684-
className={'toolbar-button'}
1685-
style={buttonStyle}
1686-
type="link"
1687-
onClick={() => addOperation('query')}>
1688-
+ ADD NEW QUERY
1689-
</button>
1690-
<button
1691-
className={'toolbar-button'}
1692-
style={buttonStyle}
1693-
type="link"
1694-
onClick={() => addOperation('mutation')}>
1695-
+ ADD NEW MUTATION
1696-
</button>
1697-
<button
1698-
className={'toolbar-button'}
1699-
style={buttonStyle}
1700-
type="link"
1701-
onClick={() => addOperation('subscription')}>
1702-
+ ADD NEW SUBSCRIPTION
1703-
</button>
1683+
{!!queryFields ? (
1684+
<button
1685+
className={'toolbar-button'}
1686+
style={buttonStyle}
1687+
type="link"
1688+
onClick={() => addOperation('query')}>
1689+
+ ADD NEW QUERY
1690+
</button>
1691+
) : null}
1692+
{!!mutationFields ? (
1693+
<button
1694+
className={'toolbar-button'}
1695+
style={buttonStyle}
1696+
type="link"
1697+
onClick={() => addOperation('mutation')}>
1698+
+ ADD NEW MUTATION
1699+
</button>
1700+
) : null}
1701+
{!!subscriptionFields ? (
1702+
<button
1703+
className={'toolbar-button'}
1704+
style={buttonStyle}
1705+
type="link"
1706+
onClick={() => addOperation('subscription')}>
1707+
+ ADD NEW SUBSCRIPTION
1708+
</button>
1709+
) : null}
17041710
</div>
17051711
</div>
17061712
);

0 commit comments

Comments
 (0)