open-index/open-npm huggingface dataset:
npm package: @rippledb/bind-tanstack-query
Description: TanStack Query invalidation binding for RippleDB
Latest version: 0.1.3

# @rippledb/bind-tanstack-query

TanStack Query cache invalidation binding for RippleDB.

📚 **Documentation:**
[rippledb.dev/docs/adapters/bind-tanstack-query](https://rippledb.dev/docs/adapters/bind-tanstack-query)

## Installation

```bash
npm install @rippledb/bind-tanstack-query @tanstack/query-core
```

## Usage

```typescript
import {
  defineListRegistry,
  wireTanstackInvalidation,
} from "@rippledb/bind-tanstack-query";

// 1. Define which query keys depend on which entities
const registry = defineListRegistry()
  .list(["todos"], { deps: ["todos"] })
  .list(["dashboard"], { deps: ["todos", "users"] });

// 2. Wire it up
const cleanup = wireTanstackInvalidation({
  queryClient,
  store,
  registry,
  debounceMs: 50,
});

// 3. Later: cleanup() to unsubscribe
```

## Features

- Works with any TanStack Query adapter (React, Vue, Solid, Svelte)
- Debounce support to coalesce rapid-fire invalidations
- Row-level (`[entity, id]`) and entity-level (`[entity]`) invalidation
- Custom list query registry for complex dependencies

## License

MIT