The Isograph team is super excited to announce the release of Isograph v0.3.0, and a follow-up v0.3.1! The amount of features we stuffed into these releases is just absolutely massive. If we went into depth on each one, this blog post would simply be too long — so we're only covering each item in brief!
Interested in trying Isograph out? Check out the quickstart, join the Discord and watch the presentation at GraphQL conf.
Big picture
These releases improve the usability of Isograph for real-world projects. They include massive internal refactors that bring Isograph closer to a cross-platform world. And they include contributions from five new developers!
Detailed release notes
In these two releases, you'll find:
Support for Relay-style connection spec pagination
We've added a useConnectionSpecPagination
hook that makes working with Relay-style connections a breeze. Check out the GitHub demo for an example of it in action.
Fetch policies
APIs for fetching data, such as useLazyReference
and useImperativeReference
, now accept a fetch policy. Using a fetch policy, you can specify that you would like to unconditionally make a network request, to make it if there isn't enough data in the store to fulfill the entire query, or to not make the network request.
Support for refining to a concrete type and unions
GraphQL unions and interfaces are now given special fields, asConcreteType
fields, which are non-null if the union/interface has that concrete type. For example, you might select asUser
on an object of type Node
.
onComplete
and onError
callbacks
APIs for fetching data, such as useLazyReference
and useImperativeReference
, also accept onComplete
and onError
callbacks. These give you the ability to execute a callback when a network request completes or errors out.
We lifted the requirement that IDs are globally unique
Isograph no longer requires IDs to be globally unique. Instead, they only must be unique within a given typename.
link
field
Each object type has a magic link
field, which acts as a pointer to that object. So, for example, in node(id: "4") { asUser { link } }
, the link
field would be { __typename: "User", __link: "4" }
.
Compiler watch mode performance improvements
Our compiler watch mode is now more efficient, and reuses more intermediate results. This is just a taste of things to come — expect massive efficiency gains in the next release 😈.
Massively improved docs
Our docs have been overhauled. This task will never be done, but there are some serious improvements there.
A demo of using Isograph with Vite
Isograph can be used with any build framework, but so far, all of our demos have used NextJS. Now, we have a Vite demo.
Other features
- There are numerous additional validations, such as that there are no undefined or unused variables. Variables are also typechecked.
- There are improved component prop types
- We log when an environment is created
- Additional Isograph config options:
- You can use the
generated_file_header
option to specify a comment that the Isograph compiler should include in generated files. This can be used to disable auto-formatting, linting, etc. - The
module
option controls whether the Babel transform, when encountering entrypoints, will generaterequire
calls orimport
statements. - The
include_file_extensions_in_import_statements
option controls whether generated files refer to other files with or without file extensions. - The
no_babel_transform
option can be set to true if you don't have the babel transform set up.
- You can use the
- Our demos now showcase proper error handling.
- Isograph now has a peer dependency on React 18 or 19, and is not pinned to a specific version of React.
Bug fixes
- The component cache had a bug that involved components defined on interfaces and items of different types with identical IDs. (Remember, IDs are no longer required to be globally unique.)
- We fixed a long-standing issue in which errors during SSR caused infinite suspense, instead of showing an error fallback.
Other internal improvements
- We cut down on re-renders by having Isograph re-use parts of the old read out value. To my knowledge, this is done in a cutting edge way: by using the reader AST, and (though we have no benchmarks) is potentially more performant than any other solution.
- We did a substantial refactor that prepares Isograph to be able to generate SQL, OpenAPI, or any other type of query!
- We added fixture tests for added stability.
Contributors
I want to thank the many contributors that helped make this release possible:
And I want to thank the following folks who provided extremely valuable feedback:
The Isograph family is growing 😊
Conclusion
Whew! If you made it this far, congratulations! But I promise you — subsequent releases will be even more filled with features!
So why not give it a try? Check out the quickstart, join the Discord and watch the presentation at GraphQL conf.