Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 5 additions & 0 deletions .changeset/loud-rocks-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/pacer': patch
---

Removed auto-uuid key generation for devtools. Now in order for pacer devtools to detect a util, you must define a key option
1 change: 1 addition & 0 deletions .cursorignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/reference/**
4 changes: 2 additions & 2 deletions docs/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ import { pacerDevtoolsPlugin } from '@tanstack/react-pacer-devtools/production'

## Registering Utilities

Each utility should automatically be detected and displayed in the devtools. However, if you don't provide a `key` option to the utility, it will show with a uuid for its name. Give it an identifiable name with the `key` option.
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.

```tsx
const debouncer = new Debouncer(myDebounceFn, {
key: 'My Debouncer', // friendly name for the utility instead of auto-generated uuid
key: 'My Debouncer', // friendly name shown in the devtools
wait: 1000,
})
```
38 changes: 11 additions & 27 deletions docs/reference/classes/AsyncBatcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Defined in: [async-batcher.ts:278](https://github.com/TanStack/pacer/blob/main/p
### key

```ts
key: string;
key: string | undefined;
```

Defined in: [async-batcher.ts:269](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L269)
Expand All @@ -166,29 +166,13 @@ Defined in: [async-batcher.ts:266](https://github.com/TanStack/pacer/blob/main/p

## Methods

### \_emit()

```ts
_emit(): void;
```

Defined in: [async-batcher.ts:299](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L299)

Emits a change event for the async batcher instance. Mostly useful for devtools.

#### Returns

`void`

***

### abort()

```ts
abort(): void;
```

Defined in: [async-batcher.ts:493](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L493)
Defined in: [async-batcher.ts:488](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L488)

Aborts all ongoing executions with the internal abort controllers.
Does NOT cancel any pending execution that have not started yet.
Expand All @@ -206,7 +190,7 @@ Does NOT clear out the items.
addItem(item): Promise<any>;
```

Defined in: [async-batcher.ts:345](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L345)
Defined in: [async-batcher.ts:340](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L340)

Adds an item to the async batcher
If the batch size is reached, timeout occurs, or shouldProcess returns true, the batch will be processed
Expand Down Expand Up @@ -235,7 +219,7 @@ The error from the batch function if no onError handler is configured or throwOn
cancel(): void;
```

Defined in: [async-batcher.ts:506](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L506)
Defined in: [async-batcher.ts:501](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L501)

Cancels any pending execution that have not started yet.
Does NOT abort any execution already in progress.
Expand All @@ -253,7 +237,7 @@ Does NOT clear out the items.
clear(): void;
```

Defined in: [async-batcher.ts:454](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L454)
Defined in: [async-batcher.ts:449](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L449)

Removes all items from the async batcher

Expand All @@ -269,7 +253,7 @@ Removes all items from the async batcher
flush(): Promise<any>;
```

Defined in: [async-batcher.ts:428](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L428)
Defined in: [async-batcher.ts:423](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L423)

Processes the current batch of items immediately

Expand All @@ -285,7 +269,7 @@ Processes the current batch of items immediately
getAbortSignal(executeCount?): AbortSignal | null;
```

Defined in: [async-batcher.ts:482](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L482)
Defined in: [async-batcher.ts:477](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L477)

Returns the AbortSignal for a specific execution.
If no executeCount is provided, returns the signal for the most recent execution.
Expand Down Expand Up @@ -330,7 +314,7 @@ const batcher = new AsyncBatcher(
peekAllItems(): TValue[];
```

Defined in: [async-batcher.ts:436](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L436)
Defined in: [async-batcher.ts:431](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L431)

Returns a copy of all items in the async batcher

Expand All @@ -346,7 +330,7 @@ Returns a copy of all items in the async batcher
peekFailedItems(): TValue[];
```

Defined in: [async-batcher.ts:440](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L440)
Defined in: [async-batcher.ts:435](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L435)

#### Returns

Expand All @@ -360,7 +344,7 @@ Defined in: [async-batcher.ts:440](https://github.com/TanStack/pacer/blob/main/p
reset(): void;
```

Defined in: [async-batcher.ts:516](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L516)
Defined in: [async-batcher.ts:511](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L511)

Resets the async batcher state to its default values

Expand All @@ -376,7 +360,7 @@ Resets the async batcher state to its default values
setOptions(newOptions): void;
```

Defined in: [async-batcher.ts:304](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L304)
Defined in: [async-batcher.ts:299](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-batcher.ts#L299)

Updates the async batcher options

Expand Down
32 changes: 8 additions & 24 deletions docs/reference/classes/AsyncDebouncer.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Defined in: [async-debouncer.ts:231](https://github.com/TanStack/pacer/blob/main
### key

```ts
key: string;
key: string | undefined;
```

Defined in: [async-debouncer.ts:222](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L222)
Expand All @@ -143,29 +143,13 @@ Defined in: [async-debouncer.ts:219](https://github.com/TanStack/pacer/blob/main

## Methods

### \_emit()

```ts
_emit(): void;
```

Defined in: [async-debouncer.ts:252](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L252)

Emits a change event for the async debouncer instance. Mostly useful for devtools.

#### Returns

`void`

***

### abort()

```ts
abort(): void;
```

Defined in: [async-debouncer.ts:468](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L468)
Defined in: [async-debouncer.ts:463](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L463)

Aborts all ongoing executions with the internal abort controllers.
Does NOT cancel any pending execution that have not started yet.
Expand All @@ -182,7 +166,7 @@ Does NOT cancel any pending execution that have not started yet.
cancel(): void;
```

Defined in: [async-debouncer.ts:480](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L480)
Defined in: [async-debouncer.ts:475](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L475)

Cancels any pending execution that have not started yet.
Does NOT abort any execution already in progress.
Expand All @@ -199,7 +183,7 @@ Does NOT abort any execution already in progress.
flush(): Promise<ReturnType<TFn> | undefined>;
```

Defined in: [async-debouncer.ts:403](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L403)
Defined in: [async-debouncer.ts:398](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L398)

Processes the current pending execution immediately

Expand All @@ -215,7 +199,7 @@ Processes the current pending execution immediately
getAbortSignal(maybeExecuteCount?): AbortSignal | null;
```

Defined in: [async-debouncer.ts:458](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L458)
Defined in: [async-debouncer.ts:453](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L453)

Returns the AbortSignal for a specific execution.
If no maybeExecuteCount is provided, returns the signal for the most recent execution.
Expand Down Expand Up @@ -256,7 +240,7 @@ const debouncer = new AsyncDebouncer(
maybeExecute(...args): Promise<ReturnType<TFn> | undefined>;
```

Defined in: [async-debouncer.ts:317](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L317)
Defined in: [async-debouncer.ts:312](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L312)

Attempts to execute the debounced function.
If a call is already in progress, it will be queued.
Expand Down Expand Up @@ -292,7 +276,7 @@ The error from the debounced function if no onError handler is configured
reset(): void;
```

Defined in: [async-debouncer.ts:488](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L488)
Defined in: [async-debouncer.ts:483](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L483)

Resets the debouncer state to its default values

Expand All @@ -308,7 +292,7 @@ Resets the debouncer state to its default values
setOptions(newOptions): void;
```

Defined in: [async-debouncer.ts:257](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L257)
Defined in: [async-debouncer.ts:252](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-debouncer.ts#L252)

Updates the async debouncer options

Expand Down
Loading
Loading