2.0.20 • Published 12 months ago

@hazae41/glacier v2.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago
npm i @hazae41/glacier

Node Package 📦Read the docs 📚Next.js Example 🪣Expo Example 🪣Comparison with other libs 🌐

Philosophy 🧠

Glacier uses two new approaches compared to other data fetching libraries like swr or react-query: 1) Encapsulating key+fetcher+params in a single abstraction called schema. 2) Composing features with very simple hooks instead of having bloated configuration and unexpected behaviors.

function useAutoFetchMixture(query: Query) {
  useFetch(query) // Fetch on mount and url change
  useVisible(query) // Fetch when the page is focused
  useOnline(query) // Fetch when the browser is online
}

function useHelloWithAutoFetch() {
  const query = useQuery(createHelloQuery, [])
  useAutoFetchMixture(query)
  return query
}

function MyApp() {
  const { data, error } = useHelloWithAutoFetch()

  if (error != null)
    return <MyError error={error} />
  if (data == null)
    return <MyLoading />
  return <MyPage data={data} />
}

Features 🔥

  • 100% TypeScript and ESM
  • No external dependency
  • Composition-based hooks
  • Rust-like patterns
  • Transport agnostic (REST, GraphQL, WebSocket)
  • Storage agnostic (IndexedDB, localStorage)
  • Works in a Service Worker or in a serverless function
  • Per-query, encrypted, garbage-collected, persistent storage
  • Store normalization and indexes
  • Concurrent and multi-step optimistic states
  • Request deduplication, cooldown, timeout, cancellation, expiration, and retrying
  • Automatic refetching based on various signals
  • Page-based and cursor-based pagination
  • SSR & ISR support
  • React Suspense support
  • React Native support
2.0.15

1 year ago

2.0.16

1 year ago

2.0.14

1 year ago

2.0.19

12 months ago

2.0.17

12 months ago

2.0.18

12 months ago

2.0.20

12 months ago

2.0.13

1 year ago

2.0.12

2 years ago

2.0.11

2 years ago

2.0.11-9

2 years ago

2.0.11-7

2 years ago

2.0.11-8

2 years ago

2.0.11-5

2 years ago

2.0.11-6

2 years ago

2.0.11-3

2 years ago

2.0.11-4

2 years ago

2.0.11-10

2 years ago

2.0.11-1

2 years ago

2.0.11-2

2 years ago

2.0.11-0

2 years ago

2.0.9

2 years ago

2.0.10

2 years ago

2.0.10-0

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5-1

2 years ago

2.0.3

2 years ago

2.0.5-0

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.1

2 years ago

2.0.5-3

2 years ago

2.0.5-2

2 years ago

2.0.0-111

2 years ago

2.0.0-112

2 years ago

2.0.0-113

2 years ago

2.0.0-114

2 years ago

2.0.0

2 years ago

2.0.0-110

2 years ago

2.0.0-109

2 years ago

2.0.0-108

2 years ago

2.0.0-107

2 years ago

2.0.0-106

2 years ago

2.0.0-105

2 years ago

2.0.0-104

2 years ago

2.0.0-103

2 years ago

2.0.0-102

2 years ago

2.0.0-101

2 years ago

2.0.0-100

2 years ago

2.0.0-99

2 years ago

2.0.0-98

2 years ago

2.0.0-97

2 years ago

2.0.0-96

2 years ago

2.0.0-95

2 years ago