Skip to content

nmathew98/qwery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation



Simple, versatile, powerful asynchronous state management

Weekly react-qwery downloads Weekly svelte-qwery downloads Weekly vue-qwery downloads Weekly solid-qwery downloads Weekly solid-qwery downloads
CI Status License License
Open in React demo in StackBlitz Open in Svelte demo in StackBlitz Open in Vue demo in StackBlitz Open in Solid demo in StackBlitz

✨ Features

  • πŸ€ΈπŸ½β€β™‚οΈ One lightweight package to manage REST and GraphQL APIs or any other kind of API
  • πŸ”© Fully customizable behavior by creating your own cache store and query key implementations
  • Β± Request deduplication by query key
  • πŸ“’ Synchronize all instances of Qweries which share query keys
  • πŸ—‚οΈ Normalized and document caches available
  • 🧐 Sourcemaps for easy debugging
  • ⛓️‍πŸ’₯ Decouple data fetching logic from the type of API or frontend framework
  • βœ‚οΈ Simple public APIs
  • 🌏 CJS + ESM

qwery is a collection of lightweight composable hooks and helpers to aid with async state management. It was designed with the aim of simplifying architectural migrations to support building evolutionary architectures in mind.

πŸ“š For more information, check out the wiki.

βˆ‘ TLDR;

  • Normalized and document caching + structural sharing + query cancellation + automatic garbage collection + subscriptions/polling + suspense + refetching + mutations + broadcast updates + SSR = Any place βœ…
  • Backend agnostic + client side transactions + retry mechanism + batching = Any time βœ…
  • React + Vue + Solid + Svelte = Anywhere βœ…

πŸ“¦ Release

After a few bumpy 1.x.x and 2.0.x releases 😬, v2.1.x onwards are considered stable

πŸ€›πŸ½ Credits

qwery heavily draws upon ideas from:

misc:

🀝🏽 Contributions

Contributions are welcome, just make a pull request.

Most of the core logic is within shared, have avoided creating an abstract core class which requires a rerender specific to each framework because the differences between each framework make this not worth the while I think because then effort shifts towards reconciliation, for example:

  • with React we trigger a rerender by updating a counter
  • with Solid (and other signal based frameworks) we trigger a rerender by updating the qwery signal

to extract out the core into a general purpose class would be introducing data, version and dispatch signals and then updating each of these individually.

Another one is that supporting both suspense and non suspense:

  • in React we throw a Promise before proceeding
  • in Solid, we createResource
  • in Svelte, there is no suspense and we just return the async
  • in Vue, we just make the component async

"Man's duality, life and its formalities"