Skip to content

Commit 66e71ba

Browse files
authored
feat: add solid pacer provider and createQueuedSignal hook (#105)
* feat: add solid pacer provider and createQueuedSignal hook * use default options from solid pacer provider
1 parent b9c2bb3 commit 66e71ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1140
-119
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@tanstack/solid-pacer': minor
3+
---
4+
5+
Add new Solid hooks for queue management and provider
6+
7+
- Add `createQueuedSignal` - Solid equivalent of `useQueuedState` with signal-based queue item tracking
8+
- Add `PacerProvider` - Context provider for setting default pacer options in Solid apps

docs/config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,10 @@
540540
{
541541
"label": "createAsyncQueuer",
542542
"to": "framework/solid/reference/functions/createAsyncQueuer"
543+
},
544+
{
545+
"label": "createQueuedSignal",
546+
"to": "framework/solid/reference/functions/createQueuedSignal"
543547
}
544548
]
545549
}
@@ -939,6 +943,10 @@
939943
{
940944
"label": "createAsyncQueuer",
941945
"to": "framework/solid/examples/createAsyncQueuer"
946+
},
947+
{
948+
"label": "createQueuedSignal",
949+
"to": "framework/solid/examples/createQueuedSignal"
942950
}
943951
]
944952
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
id: PacerProvider
3+
title: PacerProvider
4+
---
5+
6+
# Function: PacerProvider()
7+
8+
```ts
9+
function PacerProvider(props): Element;
10+
```
11+
12+
Defined in: [solid-pacer/src/provider/PacerProvider.tsx:44](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/provider/PacerProvider.tsx#L44)
13+
14+
## Parameters
15+
16+
### props
17+
18+
[`PacerProviderProps`](../../interfaces/PacerProviderProps.md)
19+
20+
## Returns
21+
22+
`Element`

docs/framework/solid/reference/functions/createAsyncBatcher.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ title: createAsyncBatcher
88
```ts
99
function createAsyncBatcher<TValue, TSelected>(
1010
fn,
11-
initialOptions,
11+
options,
1212
selector): SolidAsyncBatcher<TValue, TSelected>;
1313
```
1414

15-
Defined in: [async-batcher/createAsyncBatcher.ts:128](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-batcher/createAsyncBatcher.ts#L128)
15+
Defined in: [solid-pacer/src/async-batcher/createAsyncBatcher.ts:129](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-batcher/createAsyncBatcher.ts#L129)
1616

1717
Creates a Solid-compatible AsyncBatcher instance for managing asynchronous batches of items, exposing Solid signals for all stateful properties.
1818

@@ -132,7 +132,7 @@ const { items, isExecuting } = asyncBatcher.state();
132132

133133
(`items`) => `Promise`\<`any`\>
134134

135-
### initialOptions
135+
### options
136136

137137
`AsyncBatcherOptions`\<`TValue`\> = `{}`
138138

docs/framework/solid/reference/functions/createAsyncDebouncer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ title: createAsyncDebouncer
88
```ts
99
function createAsyncDebouncer<TFn, TSelected>(
1010
fn,
11-
initialOptions,
11+
options,
1212
selector): SolidAsyncDebouncer<TFn, TSelected>;
1313
```
1414

15-
Defined in: [async-debouncer/createAsyncDebouncer.ts:118](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-debouncer/createAsyncDebouncer.ts#L118)
15+
Defined in: [solid-pacer/src/async-debouncer/createAsyncDebouncer.ts:119](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-debouncer/createAsyncDebouncer.ts#L119)
1616

1717
A low-level Solid hook that creates an `AsyncDebouncer` instance to delay execution of an async function.
1818

@@ -76,7 +76,7 @@ Available state properties:
7676

7777
`TFn`
7878

79-
### initialOptions
79+
### options
8080

8181
`AsyncDebouncerOptions`\<`TFn`\>
8282

docs/framework/solid/reference/functions/createAsyncQueuer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ title: createAsyncQueuer
88
```ts
99
function createAsyncQueuer<TValue, TSelected>(
1010
fn,
11-
initialOptions,
11+
options,
1212
selector): SolidAsyncQueuer<TValue, TSelected>;
1313
```
1414

15-
Defined in: [async-queuer/createAsyncQueuer.ts:120](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-queuer/createAsyncQueuer.ts#L120)
15+
Defined in: [solid-pacer/src/async-queuer/createAsyncQueuer.ts:121](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-queuer/createAsyncQueuer.ts#L121)
1616

1717
Creates a Solid-compatible AsyncQueuer instance for managing an asynchronous queue of items, exposing Solid signals for all stateful properties.
1818

@@ -124,7 +124,7 @@ const { pendingItems, activeItems } = asyncQueuer.state();
124124

125125
(`value`) => `Promise`\<`any`\>
126126

127-
### initialOptions
127+
### options
128128

129129
`AsyncQueuerOptions`\<`TValue`\> = `{}`
130130

docs/framework/solid/reference/functions/createAsyncRateLimiter.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ title: createAsyncRateLimiter
88
```ts
99
function createAsyncRateLimiter<TFn, TSelected>(
1010
fn,
11-
initialOptions,
11+
options,
1212
selector): SolidAsyncRateLimiter<TFn, TSelected>;
1313
```
1414

15-
Defined in: [async-rate-limiter/createAsyncRateLimiter.ts:129](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-rate-limiter/createAsyncRateLimiter.ts#L129)
15+
Defined in: [solid-pacer/src/async-rate-limiter/createAsyncRateLimiter.ts:130](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-rate-limiter/createAsyncRateLimiter.ts#L130)
1616

1717
A low-level Solid hook that creates an `AsyncRateLimiter` instance to limit how many times an async function can execute within a time window.
1818

@@ -87,7 +87,7 @@ Available state properties:
8787

8888
`TFn`
8989

90-
### initialOptions
90+
### options
9191

9292
`AsyncRateLimiterOptions`\<`TFn`\>
9393

docs/framework/solid/reference/functions/createAsyncThrottler.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ title: createAsyncThrottler
88
```ts
99
function createAsyncThrottler<TFn, TSelected>(
1010
fn,
11-
initialOptions,
11+
options,
1212
selector): SolidAsyncThrottler<TFn, TSelected>;
1313
```
1414

15-
Defined in: [async-throttler/createAsyncThrottler.ts:117](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-throttler/createAsyncThrottler.ts#L117)
15+
Defined in: [solid-pacer/src/async-throttler/createAsyncThrottler.ts:118](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/async-throttler/createAsyncThrottler.ts#L118)
1616

1717
A low-level Solid hook that creates an `AsyncThrottler` instance to limit how often an async function can execute.
1818

@@ -76,7 +76,7 @@ Available state properties:
7676

7777
`TFn`
7878

79-
### initialOptions
79+
### options
8080

8181
`AsyncThrottlerOptions`\<`TFn`\>
8282

docs/framework/solid/reference/functions/createBatcher.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ title: createBatcher
88
```ts
99
function createBatcher<TValue, TSelected>(
1010
fn,
11-
initialOptions,
11+
options,
1212
selector): SolidBatcher<TValue, TSelected>;
1313
```
1414

15-
Defined in: [batcher/createBatcher.ts:100](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/batcher/createBatcher.ts#L100)
15+
Defined in: [solid-pacer/src/batcher/createBatcher.ts:101](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/batcher/createBatcher.ts#L101)
1616

1717
Creates a Solid-compatible Batcher instance for managing batches of items, exposing Solid signals for all stateful properties.
1818

@@ -107,7 +107,7 @@ const { items, isRunning } = batcher.state();
107107

108108
(`items`) => `void`
109109

110-
### initialOptions
110+
### options
111111

112112
`BatcherOptions`\<`TValue`\> = `{}`
113113

docs/framework/solid/reference/functions/createDebouncedSignal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function createDebouncedSignal<TValue, TSelected>(
1212
selector?): [Accessor<TValue>, Setter<TValue>, SolidDebouncer<Setter<TValue>, TSelected>];
1313
```
1414

15-
Defined in: [debouncer/createDebouncedSignal.ts:81](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/debouncer/createDebouncedSignal.ts#L81)
15+
Defined in: [solid-pacer/src/debouncer/createDebouncedSignal.ts:81](https://github.com/TanStack/pacer/blob/main/packages/solid-pacer/src/debouncer/createDebouncedSignal.ts#L81)
1616

1717
A Solid hook that creates a debounced state value, combining Solid's createSignal with debouncing functionality.
1818
This hook provides both the current debounced value and methods to update it.

0 commit comments

Comments
 (0)