Skip to content

GraphQL Support#8

Merged
Rahuletto merged 7 commits into
mainfrom
workbench
Apr 2, 2026
Merged

GraphQL Support#8
Rahuletto merged 7 commits into
mainfrom
workbench

Conversation

@Rahuletto
Copy link
Copy Markdown
Owner

What's new

  • GraphQL support
  • Better efficiency for Websockets
  • Virtualized lists
  • Liquid Glass (for macOS 26 Tahoe)
  • Overall tweaks

Screenshots

image image image

@Rahuletto Rahuletto self-assigned this Apr 2, 2026
@Rahuletto Rahuletto added the enhancement New feature or request label Apr 2, 2026
@Rahuletto Rahuletto added this to the Create all request types milestone Apr 2, 2026
@Rahuletto Rahuletto linked an issue Apr 2, 2026 that may be closed by this pull request
@Rahuletto Rahuletto merged commit dc89f1f into main Apr 2, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds comprehensive support for GraphQL and WebSockets, including new editors, schema exploration, and background connection management. It also introduces a generic URL fetching utility and migrates macOS vibrancy to a new plugin. The review identifies several critical issues, such as the use of incorrect virtualization APIs and missing dependencies for the WebSocket message list, and the omission of authentication headers during GraphQL introspection. Feedback also highlights that WebSocket SSL verification is hardcoded and inconsistent with its documentation, and suggests improving error handling for GraphQL variable parsing to provide better user feedback.

Comment on lines +21 to +26
import {
List,
useListRef,
useDynamicRowHeight,
type RowComponentProps,
} from "react-window";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The virtualization components and hooks (List, useListRef, useDynamicRowHeight) are being imported from react-window, but these are not part of the standard react-window API. Additionally, react-window is not listed in the package.json dependencies. This will lead to a build failure or a runtime crash. Please verify the intended library (e.g., virtua or react-virtuoso) and ensure it is added to the project dependencies.

Comment on lines +203 to +254
async (targetUrl?: string) => {
const urlToFetch = targetUrl || gql.url;
if (!urlToFetch) return;
onStartLoading?.(gql.id);
setSchemaLoading(true);
setSchemaError(null);

try {
const headers: Record<string, string> = {};

(gql.headerItems || [])
.filter((h) => h.enabled && h.key)
.forEach((h) => {
headers[h.key] = h.value;
});

const result = await commands.graphqlIntrospect({
url: urlToFetch,
headers,
});

if (result.status === "error") {
throw new Error(result.error);
}

const { schema_json, error } = result.data;

if (error) {
throw new Error(error);
}

if (!schema_json) {
throw new Error("No schema returned from server");
}

const introspectionData = JSON.parse(schema_json) as IntrospectionQuery;
const schemaObj = buildClientSchema(introspectionData);
const sdl = printSchema(schemaObj);

fetchedUrlRef.current = urlToFetch;
onUpdate((prev) => ({
...prev,
schemaJSON: schema_json,
schema: sdl,
schemaLastFetched: Date.now(),
}));
} catch (err: any) {
setSchemaError(err.message || "Failed to fetch schema");
} finally {
setSchemaLoading(false);
onStopLoading?.();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The fetchSchema function for GraphQL introspection only includes headers from gql.headerItems and ignores the configured authentication (gql.auth or inherited project auth). Since many GraphQL endpoints require authentication for introspection queries, this will cause schema fetching to fail on protected APIs. You should update this function to compute and include the effective authentication headers, similar to the logic used in handleSendGraphQL.

Comment on lines +117 to +120
let tls = native_tls::TlsConnector::builder()
.danger_accept_invalid_certs(false)
.build()
.map_err(|e| format!("TLS setup error: {e}"))?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The SSL certificate verification is hardcoded to false (strict verification), which contradicts the comment stating it should "Accept any cert in dev". This prevents connections to local or development WebSocket servers using self-signed certificates. This setting should be configurable via the WsConnectRequest to match the flexibility provided for REST requests.

Comment thread src-tauri/src/types.rs
Comment on lines +174 to +183
pub struct WsConnectRequest {
/// Unique connection ID chosen by the caller (e.g. the WebSocketFile id).
pub connection_id: String,
/// The WebSocket URL to connect to (ws:// or wss://).
pub url: String,
/// Optional extra headers to include in the upgrade handshake.
pub headers: HashMap<String, String>,
/// Optional sub-protocols.
pub protocols: Vec<String>,
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The WsConnectRequest struct is missing a verify_ssl field. Adding this field is necessary to allow users to toggle SSL verification for WebSocket connections, which is a common requirement when working with development servers or self-signed certificates.

Comment thread src/App.tsx
Comment on lines +753 to +760
let variables: Record<string, unknown> = {};
try {
if (activeGraphQL.variables && activeGraphQL.variables.trim() !== "") {
variables = JSON.parse(activeGraphQL.variables);
}
} catch {
// invalid JSON variables, send as-is
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

When parsing GraphQL variables, if JSON.parse fails, the error is silently caught and the request proceeds with an empty variables object. This can be misleading for users as their input is ignored without any indication of a syntax error. It would be better to validate the JSON and provide feedback (e.g., via a toast) or prevent the request if the variables are malformed.

@Rahuletto Rahuletto deleted the workbench branch April 2, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support GraphQL

1 participant