Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove GraphiQL Explorer; fix headers property #1174

Merged
merged 3 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Ui.GraphiQL/GraphiQLOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ public class GraphiQLOptions

/// <summary>
/// Enables the header editor when <see langword="true"/>.
/// Not supported when <see cref="ExplorerExtensionEnabled"/> is <see langword="true"/>.
/// </summary>
/// <remarks>
/// Original setting from <see href="https://github.com/graphql/graphiql/blob/08250feb6ee8335c3b1ca83a912911ae92a75722/packages/graphiql/src/components/GraphiQL.tsx#L186">GraphiQL</see>.
/// </remarks>
public bool HeaderEditorEnabled { get; set; } = true;

/// <summary>
/// Enables the explorer extension when <see langword="true"/>.
/// This property has no effect.
/// </summary>
[Obsolete("This property has no effect and will be removed in a future version.")]
public bool ExplorerExtensionEnabled { get; set; } = true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no code tied to this property within the entire codebase. So it could not be disabled.


/// <summary>
Expand Down
13 changes: 1 addition & 12 deletions src/Ui.GraphiQL/Internal/graphiql.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,6 @@
integrity="sha384-yz3/sqpuplkA7msMo0FE4ekg0xdwdvZ8JX9MVZREsxipqjU4h8IRfmAMRcb1QpUy"
crossorigin="anonymous"
/>
<script
src="https://unpkg.com/[email protected]/graphiqlWithExtensions.min.js"
integrity="sha384-TqI6gT2PjmSrnEOTvGHLad1U4Vm5VoyzMmcKK0C/PLCWTnwPyXhCJY6NYhC/tp19"
crossorigin="anonymous"
></script>
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/graphiqlWithExtensions.css"
integrity="sha384-GBqwox+q8UtVEyBLBKloN5QDlBDsQnuoSUfMeJH1ZtDiCrrk103D7Bg/WjIvl4ya"
crossorigin="anonymous"
/>
Comment on lines -59 to -69
Copy link
Member Author

@Shane32 Shane32 Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graphiql-with-extensions was last released 5 years ago, and its package.json indicates that it was designed for version 0.14.2 of GraphiQL. It does not appear to be compatible with GraphiQL 3.x and so I removed it. GraphiQL does have a docs explorer built-in, although it does not have the checkbox functionality that the graphiql-explorer extension did.

See:

<script
src="https://unpkg.com/[email protected]/browser/client.js"
integrity="sha384-Eqe2SG8kA+Au+rwrgfWJ+epqYAtKGW/As+WdcywebVKX7377xelWa+/il4CHiHXI"
Expand Down Expand Up @@ -286,7 +275,7 @@
onEditQuery: onEditQuery,
onEditVariables: onEditVariables,
onEditOperationName: onEditOperationName,
headerEditorEnabled: @Model.HeaderEditorEnabled,
isHeadersEditorEnabled: @Model.HeaderEditorEnabled,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HeaderEditorEnabled property was ineffective because the react property name was incorrect. This change fixes the bug.

}),
document.getElementById('graphiql'),
);
Expand Down
Loading