Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions docs/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ id: devtools

What? My debouncer can have dedicated devtools? Yep!

TanStack Pacer provides devtools for debugging and monitoring all your utilities in real-time. The devtools integrate seamlessly within the new [TanStack Devtools](https://tanstack.com/devtools) multi-panel UI.
TanStack Pacer ships devtools for watching and debugging every registered utility in real time. They run as a plugin inside the [TanStack Devtools](https://tanstack.com/devtools) multi-panel UI.

> [!NOTE]
> By default, the TanStack Devtools and TanStack Pacer Devtools will only be included in development mode. This helps keep your production bundle size minimal. If you need to include devtools in production builds (e.g., for debugging production issues), you can use the alternative "production" imports.
> [!NOTE]
> The devtools are excluded from production builds by default, so they add nothing to your production bundle. See [Production builds](#production-builds) if you need them in production.

## Installation

Expand All @@ -30,9 +30,9 @@ npm install @tanstack/solid-devtools @tanstack/solid-pacer-devtools

Coming soon...

## Basic Setup
## Basic setup

### React Setup
### React setup

```tsx
import { TanStackDevtools } from '@tanstack/react-devtools'
Expand All @@ -54,7 +54,7 @@ function App() {
}
```

### Solid Setup
### Solid setup

```tsx
import { TanStackDevtools } from '@tanstack/solid-devtools'
Expand All @@ -76,25 +76,25 @@ function App() {
}
```

## Production Builds
## Production builds

By default, devtools are excluded from production builds to minimize bundle size. The default imports will return no-op implementations in production:
The default imports become no-ops in production builds:

```tsx
// This will be a no-op in production builds
// This is a no-op in production builds
import { pacerDevtoolsPlugin } from '@tanstack/react-pacer-devtools'
```

If you need to include devtools in production builds (e.g., for debugging production issues), use the production-specific imports:
To debug a production issue with full devtools, switch to the production-specific imports:

```tsx
// This will include full devtools even in production builds
// This includes full devtools even in production builds
import { pacerDevtoolsPlugin } from '@tanstack/react-pacer-devtools/production'
```

## Registering Utilities
## Registering utilities

Pacer utilities only register with the devtools when you pass a `key`. Keys are no longer generated automatically, so leave the option out if you do not want an instance to appear in the panels.
A utility only registers with the devtools when you give it a `key`. Leave the option out and the instance stays out of the panels.

```tsx
const debouncer = new Debouncer(myDebounceFn, {
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/angular/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install @tanstack/angular-pacer

See the [Angular inject API Reference](./reference/index.md) for the full list of inject functions (injectDebouncer, injectThrottler, injectRateLimiter, injectQueuer, injectBatcher, and their async and callback variants).

## Basic Usage
## Basic usage

Inject a Pacer utility in your component or service. Each inject function returns an object that exposes methods and a reactive `state()` signal when you pass a selector.

Expand Down
42 changes: 21 additions & 21 deletions docs/framework/preact/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ title: TanStack Pacer Preact Adapter
id: adapter
---

If you are using TanStack Pacer in a Preact application, we recommend using the Preact Adapter. The Preact Adapter provides a set of easy-to-use hooks on top of the core Pacer utilities. If you find yourself wanting to use the core Pacer classes/functions directly, the Preact Adapter will also re-export everything from the core package.
In a Preact application, use the Preact Adapter. Its hooks wrap the core Pacer utilities with lifecycle cleanup and reactive state. The adapter also re-exports everything from the core package, so you can import the plain classes and functions from the same place.

## Installation

```sh
npm install @tanstack/preact-pacer
```

## Preact Hooks
## Preact hooks

See the [Preact Functions Reference](./reference/index.md) to see the full list of hooks available in the Preact Adapter.
See the [Preact Functions Reference](./reference/index.md) for the full list of hooks in the Preact Adapter.

## Basic Usage
## Basic usage

Import a preact specific hook from the Preact Adapter.
Import a Preact-specific hook from the Preact Adapter.

```tsx
import { useDebouncedValue } from '@tanstack/preact-pacer'
Expand All @@ -35,11 +35,11 @@ Or import a core Pacer class/function that is re-exported from the Preact Adapte
import { debounce, Debouncer } from '@tanstack/preact-pacer' // no need to install the core package separately
```

## Option Helpers
## Option helpers

If you want a type-safe way to define common options for pacer utilities, TanStack Pacer provides option helpers for each utility. These helpers can be used with Preact hooks.
Option helpers define shared options with full type checking, so you can declare them once and reuse them across hooks.

### Debouncer Options
### Debouncer options

```tsx
import { useDebouncer } from '@tanstack/preact-pacer'
Expand All @@ -57,7 +57,7 @@ const debouncer = useDebouncer(
)
```

### Async Queuer Options
### Async queuer options

```tsx
import { useAsyncQueuer } from '@tanstack/preact-pacer'
Expand All @@ -74,7 +74,7 @@ const queuer = useAsyncQueuer(
)
```

### Rate Limiter Options
### Rate limiter options

```tsx
import { useRateLimiter } from '@tanstack/preact-pacer'
Expand All @@ -94,7 +94,7 @@ const rateLimiter = useRateLimiter(

## Provider

The Preact Adapter provides a `PacerProvider` component that you can use to provide default options to all instances of pacer utilities within your component tree.
The `PacerProvider` component sets default options for every Pacer utility instance in its component tree.

```tsx
import { PacerProvider } from '@tanstack/preact-pacer'
Expand All @@ -111,15 +111,15 @@ import { PacerProvider } from '@tanstack/preact-pacer'
</PacerProvider>
```

All hooks within the provider will automatically use these default options, which can be overridden on a per-hook basis.
Hooks inside the provider use these defaults. Options passed to an individual hook override them.

## Subscribing to State
## Subscribing to state

The Preact Adapter supports subscribing to state changes in two ways:

### Using the Subscribe Component
### Using the Subscribe component

Use the `Subscribe` component to subscribe to state changes deep in your component tree without needing to pass a selector to the hook. This is ideal when you want to subscribe to state in child components.
Use the `Subscribe` component to read state deep in the component tree without passing a selector to the hook.

```tsx
import { useRateLimiter } from '@tanstack/preact-pacer'
Expand Down Expand Up @@ -151,11 +151,11 @@ function ApiComponent() {
}
```

### Using the Selector Parameter
### Using the selector parameter

The `selector` parameter allows you to specify which state changes will trigger reactive updates at the hook level, optimizing performance by preventing unnecessary updates when irrelevant state changes occur.
The `selector` parameter controls which state changes trigger reactive updates. State you do not select never causes an update.

**By default, `hook.state` is empty (`{}`) as the selector is empty by default.** You must opt-in to state tracking by providing a selector function.
Without a selector, `hook.state` is an empty object (`{}`). Pass a selector function to opt in to state tracking.

```tsx
import { useDebouncer } from '@tanstack/preact-pacer'
Expand Down Expand Up @@ -189,7 +189,7 @@ For more details on state management and available state properties, see the ind

## Examples

### Debouncer Example
### Debouncer example

```tsx
import { useDebouncer } from '@tanstack/preact-pacer'
Expand All @@ -212,7 +212,7 @@ function SearchComponent() {
}
```

### Async Queuer Example
### Async queuer example

```tsx
import { useAsyncQueuer } from '@tanstack/preact-pacer'
Expand Down Expand Up @@ -245,7 +245,7 @@ function UploadComponent() {
}
```

### Rate Limiter Example
### Rate limiter example

```tsx
import { useRateLimiter } from '@tanstack/preact-pacer'
Expand Down
42 changes: 21 additions & 21 deletions docs/framework/react/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ title: TanStack Pacer React Adapter
id: adapter
---

If you are using TanStack Pacer in a React application, we recommend using the React Adapter. The React Adapter provides a set of easy-to-use hooks on top of the core Pacer utilities. If you find yourself wanting to use the core Pacer classes/functions directly, the React Adapter will also re-export everything from the core package.
In a React application, use the React Adapter. Its hooks wrap the core Pacer utilities with lifecycle cleanup and reactive state. The adapter also re-exports everything from the core package, so you can import the plain classes and functions from the same place.

## Installation

```sh
npm install @tanstack/react-pacer
```

## React Hooks
## React hooks

See the [React Functions Reference](./reference/index.md) to see the full list of hooks available in the React Adapter.
See the [React Functions Reference](./reference/index.md) for the full list of hooks in the React Adapter.

## Basic Usage
## Basic usage

Import a react specific hook from the React Adapter.
Import a React-specific hook from the React Adapter.

```tsx
import { useDebouncedValue } from '@tanstack/react-pacer'
Expand All @@ -34,11 +34,11 @@ Or import a core Pacer class/function that is re-exported from the React Adapter
import { debounce, Debouncer } from '@tanstack/react-pacer' // no need to install the core package separately
```

## Option Helpers
## Option helpers

If you want a type-safe way to define common options for pacer utilities, TanStack Pacer provides option helpers for each utility. These helpers can be used with React hooks.
Option helpers define shared options with full type checking, so you can declare them once and reuse them across hooks.

### Debouncer Options
### Debouncer options

```tsx
import { useDebouncer } from '@tanstack/react-pacer'
Expand All @@ -56,7 +56,7 @@ const debouncer = useDebouncer(
)
```

### Async Queuer Options
### Async queuer options

```tsx
import { useAsyncQueuer } from '@tanstack/react-pacer'
Expand All @@ -73,7 +73,7 @@ const queuer = useAsyncQueuer(
)
```

### Rate Limiter Options
### Rate limiter options

```tsx
import { useRateLimiter } from '@tanstack/react-pacer'
Expand All @@ -93,7 +93,7 @@ const rateLimiter = useRateLimiter(

## Provider

The React Adapter provides a `PacerProvider` component that you can use to provide default options to all instances of pacer utilities within your component tree.
The `PacerProvider` component sets default options for every Pacer utility instance in its component tree.

```tsx
import { PacerProvider } from '@tanstack/react-pacer'
Expand All @@ -110,15 +110,15 @@ import { PacerProvider } from '@tanstack/react-pacer'
</PacerProvider>
```

All hooks within the provider will automatically use these default options, which can be overridden on a per-hook basis.
Hooks inside the provider use these defaults. Options passed to an individual hook override them.

## Subscribing to State
## Subscribing to state

The React adapter supports subscribing to state changes in two ways:

### Using the Subscribe Component
### Using the Subscribe component

Use the `Subscribe` component to subscribe to state changes deep in your component tree without needing to pass a selector to the hook. This is ideal when you want to subscribe to state in child components.
Use the `Subscribe` component to read state deep in the component tree without passing a selector to the hook.

```tsx
import { useRateLimiter } from '@tanstack/react-pacer'
Expand Down Expand Up @@ -150,11 +150,11 @@ function ApiComponent() {
}
```

### Using the Selector Parameter
### Using the selector parameter

The `selector` parameter allows you to specify which state changes will trigger reactive updates at the hook level, optimizing performance by preventing unnecessary updates when irrelevant state changes occur.
The `selector` parameter controls which state changes trigger reactive updates. State you do not select never causes an update.

**By default, `hook.state` is empty (`{}`) as the selector is empty by default.** You must opt-in to state tracking by providing a selector function.
Without a selector, `hook.state` is an empty object (`{}`). Pass a selector function to opt in to state tracking.

```tsx
import { useDebouncer } from '@tanstack/react-pacer'
Expand Down Expand Up @@ -188,7 +188,7 @@ For more details on state management and available state properties, see the ind

## Examples

### Debouncer Example
### Debouncer example

```tsx
import { useDebouncer } from '@tanstack/react-pacer'
Expand All @@ -211,7 +211,7 @@ function SearchComponent() {
}
```

### Async Queuer Example
### Async queuer example

```tsx
import { useAsyncQueuer } from '@tanstack/react-pacer'
Expand Down Expand Up @@ -244,7 +244,7 @@ function UploadComponent() {
}
```

### Rate Limiter Example
### Rate limiter example

```tsx
import { useRateLimiter } from '@tanstack/react-pacer'
Expand Down
Loading
Loading