Skip to content

Instantly share code, notes, and snippets.

@randallb
Last active September 7, 2025 17:35
Show Gist options
  • Save randallb/df13780a215c74f3f9e05d81f4fe6e03 to your computer and use it in GitHub Desktop.
Save randallb/df13780a215c74f3f9e05d81f4fe6e03 to your computer and use it in GitHub Desktop.
Isograph compiler 0.0.0-main-620f4c6f: Invalid field in @exposeField directive repro

Isograph compiler main (620f4c6f) repro: Invalid field \node` in @exposeField directive`

This is a minimal reproduction of a compiler error on @isograph/[email protected] when selecting a Relay-style connection field with edges { node { ... } }.

Versions

Note: The same project compiles successfully with @isograph/[email protected].

Files

  • isograph.config.json: standard config pointing to schema.graphql
  • schema.graphql: defines a simple Relay-style connection (Connection → edges → node)
  • src/MyComp.tsx: minimal iso component selecting items { edges { node { id name } } }

Reproduction

Run from the repo root of this gist:

 deno run -A npm:@isograph/[email protected] compile

Actual output

INFO Starting to compile.

ERROR Error when compiling.

Invalid field `node` in @exposeField directive
<generated>
Compilation took 1ms.

Expected

  • The compiler should accept Relay-style connections and compile successfully (as it does on @isograph/[email protected]).

Notes and attempts

  • Aliasing the selection (e.g., item: node { ... }) does not avoid the error; it still fails with the same message.
  • In our larger codebase, we also refactored to avoid defining components on connection types (moved them to the parent type and passed through the connection). The error persists on main.

Workarounds

  • Pin to @isograph/[email protected] and @isograph/[email protected] (compiles cleanly).
  • If schema can change: rename edge field from node to something else (e.g., item) or expose a nodes: [Item] list alongside edges and select from that. This avoids selecting node entirely.

Proposed fix / request

  • If node is intentionally disallowed for @exposeField, please document the new supported connection pattern and/or provide a configuration flag to permit Relay-style edges { node } selections.
  • If this is an unintended regression, consider allowing the node field in @exposeField generation (matching prior behavior in 0.3.1) or mapping it internally without error.

Thanks!

{
"project_root": ".",
"artifact_directory": "./__generated__",
"schema": "./schema.graphql",
"options": {
"include_file_extensions_in_import_statements": true,
"no_babel_transform": true
}
}
// Minimal Isograph component to reproduce the issue
// No runtime is required; the compiler only parses the iso template.
// Pretend iso exists; actual import isn’t needed for the compiler to parse.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declare const iso: any;
export const MyComp = iso(`
field Query.MyComp @component {
items(first: 10) {
edges {
node {
id
name
}
}
}
}
`)(function MyComp() {
return null;
});
schema {
query: Query
}
interface Node {
id: ID!
}
type Item implements Node {
id: ID!
name: String
}
type ItemEdge {
cursor: String!
node: Item
}
type ItemConnection {
edges: [ItemEdge]
pageInfo: PageInfo!
}
type PageInfo {
endCursor: String
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
}
type Query {
items(first: Int): ItemConnection
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment