urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

MIT License

Downloads
11.4M
Stars
8.5K
Committers
249

Bot releases are hidden (Show)

urql - v1.6.2

Published by kitten almost 5 years ago

This fixes a potentially critical bug, where a component would enter an infinite rerender loop,
when another hook triggers an update. This may happen when multiple useQuery hooks are used in
a single component or when another state hook triggers a synchronous update.

  • Add generic type-parameter to client.query and client.mutation, by @ctrlplusb (see #456)
  • ⚠️ Fix useQuery entering an infinite loop during SSR when an update is triggered (see #459)
urql - v1.6.1

Published by kitten about 5 years ago

  • Fix hook updates not being propagated to potential context providers (see #451)
urql - v1.6.0

Published by kitten about 5 years ago

This release comes with stability improvements for the useQuery and useSubscription hooks
when using suspense and concurrent mode. They should behave the same as before under normal
circumstances and continue to deliver the correct state on initial mount and updates.
The useQuery hook may however now trigger suspense updates when its inputs are changing,
as it should, instead of erroneously throwing a promise in useEffect.

The added stale: boolean flag on the hooks indicates whether a result is "stale".
useQuery will expose stale: true on results that are cached but will be updated
due to the use of cache-and-network.

We've also made some changes so that client.query() won't throw a promise, when suspense
mode is activated.

  • ✨ Add stale flag to OperationResult and hook results (see #449)
  • Replace useImmeditateEffect and useImmediateState with react-wonka derived state and effect (see #447)
  • Add (internal) suspense flag to OperationContext
urql - v1.5.1

Published by kitten about 5 years ago

  • Replace fast-json-stable-stringify with embedded code (see #426)
  • ⚠ Prevent caching null data (see #437)
urql - v1.5.0

Published by kitten about 5 years ago

This release finally adds shortcuts to imperatively make queries and mutations.
They make it easier to quickly use the client programmatically, either with
a Wonka source-based or Promise-based call.

// Call .query or .mutation which return Source<OperationResult>
const source = client.query(doc, vars);
const source = client.mutation(doc, vars);
// Call .toPromise() on the source to get Promise<OperationResult>
const promise = client.query(doc, vars).toPromise();
const promise = client.mutation(doc, vars).toPromise();

This version also adds a useClient hook as a shortcut for useContext(Context).
We provide a default client that makes requests to /graphql. Since that has
confused users before, we now log a warning, when it's used.

  • ✨ Implement client.query() and client.mutation() (see #405)
  • Fix useImmediateEffect for concurrent mode (see #418)
  • Deconstruct Wonka.pipe using a Babel transform (see #419)
  • ⚠ Add useClient hook and warning when default client is used (see #420)
urql - v1.4.1

Published by kitten about 5 years ago

This release adds "active teardowns" for operations, which means that an exchange can now send a teardown to cancel ongoing operations. The subscriptionsExchange for instance now ends ongoing subscriptions proactively if the server says that they've completed! This is also reflected as fetching: false in the useQuery and useSubscription hook.

We've also fixed a small issue with suspense and added all features from useQuery to useSubscription! This includes the pause argument and an executeSubscription function.

  • ✨ Implement active teardowns and add missing features to useSubscription (see #410)
  • Fix UseMutationResponse TypeScript type, by @jbugman (see #412)
  • Exclude subscriptions from suspense source (see #415)
urql - v1.4.0

Published by kitten about 5 years ago

This release removes all metadata for the @urql/devtools extension from the core
urql package. This data will now be generated internally in the devtools exchange
itself. Please also upgrade to the latest @urql/devtools version if you're using
the extension.

This release has mainly been focused on minor refactors to keep the bundlesize low.
But it also introduces new features, like specifying a default requestPolicy and
a new polling option on useQuery!

This release also exports makeResult and makeErrorResult, which will reduce the
boilerplate code that you need for custom fetch exchanges.

  • Minor bundlesize optimizations and remove debugExchange in production (see #375)
  • ✨ Add requestPolicy option to Client to change the default request policy (see #376)
  • ⚠ Remove dependency on graphql-tag and improve Operation.key hashing (see #383)
  • Remove networkLatency and source metadata from context, and delete useDevtoolsContext (see #387 and #388)
  • ✨ Add support for polling with pollInterval argument to useQuery, by @mxstbr (see #397)
  • ⚠ Prevent __typename from being added to the toplevel GraphQL documents (see #399)
  • Add operationName field to fetch request body (see #401)
urql - v1.3.0

Published by kitten about 5 years ago

This release comes with some important fixes and enhancements, which all address
certain edge-cases when using urql.

It fixes the cache-and-network request policy, which wouldn't always work correctly and issue another network request after resolving a response from the default cache. We also had a major bug in React Native environments where responses wouldn't ever be reflected in the useQuery hook's state. Lastly, you can now use extensions from your GraphQL servers and modify the OperationContext from the hooks options.

  • ✨ Add support for extensions key in GraphQL responses, by @adamscybot (see #355)
  • ⚠ Fix cache-and-network request policy by adding operation flushing to the client (see #356)
  • Add fetch option to the Client so it doesn't have to be polyfilled globally (see #357 and #359)
  • ⚠ Fix useImmediateState for React Native environments (see #358)
  • ✨ Add context option to all hooks to allow OperationContext to be changed dynamically (see #351)
  • Add isClient option to ssrExchange in case suspense is activated on the client-side (see #369)
urql - v1.2.0

Published by andyrichardson over 5 years ago

A release focused on improving developer experience (in preparation for the
upcoming devtools) as well as minor documentation improvements and bug fixes.

  • Add metadata to operation context in development (see #305, #324, #325 and #329)
  • Fix minor typename memory leak (see #321)
  • Fix types for react subscription components (see #328)
  • Fix displayName attributes not populated in examples (see #330)
  • Fix error in collectTypes method (see #343)
  • Fix HTTP status bounds check error (see #348)
urql - v1.1.3

Published by kitten over 5 years ago

This is a hotfix that patches a small regression from 1.1.2 where
useQuery would crash due to an incorrect teardown function from pause.

urql - v1.1.2

Published by kitten over 5 years ago

This patch fixes a small bug that usually manifests in development,
where the initial state would be incorrect after a fast response from
the GraphQL API. This used to lock the state into fetching: true
indefinitely in some cases.

  • Export all TS types for components (see #312)
  • ⚠️ Fix state getting stuck on initial mount for fast responses (see #310)
  • Refactor build tooling to be driven only by Rollup (see #306)
  • Remove dev-only dependencies from dependencies (see #304)
urql - v1.1.1

Published by kitten over 5 years ago

This release comes with two small patches. One being a crticial fix, where cancelled requests would be erroneously deduped, which meant a previously cancelled query would never be fetched.

It also refactors our bundling process to transpile Object.assign to restore IE11 support and reduce the amount of duplicate helper in our bundles.

  • ⚠️ Fix torn-down requests being deduped forever (see #281)
  • Fix useQuery's pause argument blocking explicit executeQuery calls (see #278)
  • Add Object.assign transpilation for IE11 and refactor bundling (see #274)
urql - v1.1.0 – Server-side Rendering Support!

Published by kitten over 5 years ago

After our recent announcement of urql v1 we've received lots of positive feedback and support, but it became clear that the most requested feature for urql was server-side rendering.

So we went back into the machine room and implemented it, so today we're publishing urql v1.1, just a week after our blog post! Our new implementation of server-side rendering works by adding a single new exchange, the ssrExchange, and using a new suspense-mode on the server-side, which can be used together with react-ssr-prepass to prefetch urql queries. 🎉

Getting started with server-side rendering in urql is easy! We've got an extensive guide on how to set it up, which you can read on our new & fancy docs site, or alternatively as markdown on GitHub.

We've also added a new example to our repository based on Next.js!

Changes

This version now also requires a version of React supporting hooks! (>= 16.8.0)
We unfortunately forgot to correct the peerDependencies entries in our v1.0.0 release.

  • ✨ Add server-side rendering support (see #268)
  • ✨ Ensure that state changes are applied immediately on mount (see #256)
  • Ensure that effects are run immediately on mount (see #250)
  • ⚠️ Remove create-react-context and bump React peer dependency (see #252)
  • Add generics to the Query, Mutation, and Subscription components
  • ⚠️ Fix issues where useQuery wouldn't update or teardown correctly (see #243)
  • ✨ Add support for pause prop/option to useQuery and Query (see #237)

urql - v1.0.5

Published by kitten over 5 years ago

  • Export MutationProps types for TS typings, by @mxstbr (see #236)
  • Export Use*Args types for TS typings, by @mxstbr (see #235)
  • Export all hook response types for TS typings, by @good-idea (see #233)
  • ⚠ Fix runtime error in cachExchange where already deleted keys where being accessed (see #223)
  • ⚠️ Fix cacheExchange not forwarding teardowns correctly, which lead to unnecessary/outdated queries being executed, by @federicobadini (see #222)
  • Change GraphQLRequest to always pass on a parsed GraphQL DocumentNode instead of just a string, which reduces work (see #221)
  • Fix incorrect TS types by using Omit<T, K> (see #220)
urql - v1.0.4

Published by kitten over 5 years ago

  • Fix __typename not being extracted from responses correctly, which broke caching
  • Fix fetchOptions being called in the client instead of the fetch exchange
  • Improve CombinedError to actually be an Error and rehydrate GraphQLError instances
  • Fix Mutation#executeMutation prop not accepting generics
urql - v1.0.3

Published by kitten over 5 years ago

  • Fix variables not being diff'ed and only compared via reference equality leading to an infinite rerender bug
urql - v1.0.2

Published by kitten over 5 years ago

  • Allow graphql-tag usage. Operations' querys can now be DocumentNodes
  • Query + Variables keying is now more optimised than before with more efficient hashing
urql - v1.0.0 – Customisable & The one with hooks.

Published by kitten over 5 years ago

urql v1 is more customisable than ever with a concept of "exchanges", which allow you to customise every aspect of how urql works. Check out the docs for more info on v1!