2.0.13 • Published 2 months ago

@hazae41/glacier v2.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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.13

2 months ago

2.0.12

3 months ago

2.0.11

3 months ago

2.0.11-9

3 months ago

2.0.11-7

3 months ago

2.0.11-8

3 months ago

2.0.11-5

3 months ago

2.0.11-6

3 months ago

2.0.11-3

3 months ago

2.0.11-4

3 months ago

2.0.11-10

3 months ago

2.0.11-1

3 months ago

2.0.11-2

3 months ago

2.0.11-0

3 months ago

2.0.9

3 months ago

2.0.10

3 months ago

2.0.10-0

3 months ago

2.0.8

4 months ago

2.0.7

4 months ago

2.0.6

5 months ago

2.0.5-1

5 months ago

2.0.3

5 months ago

2.0.5-0

5 months ago

2.0.2

5 months ago

2.0.5

5 months ago

2.0.4

5 months ago

2.0.1

5 months ago

2.0.5-3

5 months ago

2.0.5-2

5 months ago

2.0.0-111

5 months ago

2.0.0-112

5 months ago

2.0.0-113

5 months ago

2.0.0-114

5 months ago

2.0.0

5 months ago

2.0.0-110

5 months ago

2.0.0-109

6 months ago

2.0.0-108

6 months ago

2.0.0-107

6 months ago

2.0.0-106

7 months ago

2.0.0-105

7 months ago

2.0.0-104

7 months ago

2.0.0-103

7 months ago

2.0.0-102

7 months ago

2.0.0-101

7 months ago

2.0.0-100

7 months ago

2.0.0-99

7 months ago

2.0.0-98

7 months ago

2.0.0-97

7 months ago

2.0.0-96

7 months ago

2.0.0-95

8 months ago