@tanstack/preact-pacer 0.20.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/async-batcher/useAsyncBatcher.cjs +2 -2
- package/dist/async-batcher/useAsyncBatcher.cjs.map +1 -1
- package/dist/async-batcher/useAsyncBatcher.js +3 -3
- package/dist/async-batcher/useAsyncBatcher.js.map +1 -1
- package/dist/async-debouncer/useAsyncDebouncer.cjs +2 -2
- package/dist/async-debouncer/useAsyncDebouncer.cjs.map +1 -1
- package/dist/async-debouncer/useAsyncDebouncer.js +3 -3
- package/dist/async-debouncer/useAsyncDebouncer.js.map +1 -1
- package/dist/async-queuer/useAsyncQueuer.cjs +2 -2
- package/dist/async-queuer/useAsyncQueuer.cjs.map +1 -1
- package/dist/async-queuer/useAsyncQueuer.js +3 -3
- package/dist/async-queuer/useAsyncQueuer.js.map +1 -1
- package/dist/async-rate-limiter/useAsyncRateLimiter.cjs +2 -2
- package/dist/async-rate-limiter/useAsyncRateLimiter.cjs.map +1 -1
- package/dist/async-rate-limiter/useAsyncRateLimiter.js +3 -3
- package/dist/async-rate-limiter/useAsyncRateLimiter.js.map +1 -1
- package/dist/async-throttler/useAsyncThrottler.cjs +2 -2
- package/dist/async-throttler/useAsyncThrottler.cjs.map +1 -1
- package/dist/async-throttler/useAsyncThrottler.js +3 -3
- package/dist/async-throttler/useAsyncThrottler.js.map +1 -1
- package/dist/batcher/useBatcher.cjs +2 -2
- package/dist/batcher/useBatcher.cjs.map +1 -1
- package/dist/batcher/useBatcher.js +3 -3
- package/dist/batcher/useBatcher.js.map +1 -1
- package/dist/debouncer/useDebouncer.cjs +2 -2
- package/dist/debouncer/useDebouncer.cjs.map +1 -1
- package/dist/debouncer/useDebouncer.js +3 -3
- package/dist/debouncer/useDebouncer.js.map +1 -1
- package/dist/provider/PacerProvider.cjs.map +1 -1
- package/dist/provider/PacerProvider.d.cts +2 -2
- package/dist/provider/PacerProvider.d.ts +2 -2
- package/dist/provider/PacerProvider.js.map +1 -1
- package/dist/queuer/useQueuer.cjs +2 -2
- package/dist/queuer/useQueuer.cjs.map +1 -1
- package/dist/queuer/useQueuer.js +3 -3
- package/dist/queuer/useQueuer.js.map +1 -1
- package/dist/rate-limiter/useRateLimiter.cjs +2 -2
- package/dist/rate-limiter/useRateLimiter.cjs.map +1 -1
- package/dist/rate-limiter/useRateLimiter.js +3 -3
- package/dist/rate-limiter/useRateLimiter.js.map +1 -1
- package/dist/throttler/useThrottler.cjs +2 -2
- package/dist/throttler/useThrottler.cjs.map +1 -1
- package/dist/throttler/useThrottler.js +3 -3
- package/dist/throttler/useThrottler.js.map +1 -1
- package/package.json +5 -5
- package/src/async-batcher/useAsyncBatcher.ts +5 -3
- package/src/async-debouncer/useAsyncDebouncer.ts +5 -3
- package/src/async-queuer/useAsyncQueuer.ts +5 -3
- package/src/async-rate-limiter/useAsyncRateLimiter.ts +5 -3
- package/src/async-throttler/useAsyncThrottler.ts +5 -3
- package/src/batcher/useBatcher.ts +5 -3
- package/src/debouncer/useDebouncer.ts +5 -3
- package/src/queuer/useQueuer.ts +5 -3
- package/src/rate-limiter/useRateLimiter.ts +5 -3
- package/src/throttler/useThrottler.ts +5 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { AsyncBatcher } from '@tanstack/pacer/async-batcher'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type {
|
|
@@ -252,7 +252,9 @@ export function useAsyncBatcher<TValue, TSelected = {}>(
|
|
|
252
252
|
selector: (state: AsyncBatcherState<TValue>) => TSelected
|
|
253
253
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
254
254
|
}) {
|
|
255
|
-
const selected = useStore(batcherInstance.store, props.selector
|
|
255
|
+
const selected = useStore(batcherInstance.store, props.selector, {
|
|
256
|
+
equal: shallow,
|
|
257
|
+
})
|
|
256
258
|
|
|
257
259
|
return typeof props.children === 'function'
|
|
258
260
|
? props.children(selected)
|
|
@@ -278,7 +280,7 @@ export function useAsyncBatcher<TValue, TSelected = {}>(
|
|
|
278
280
|
}, [])
|
|
279
281
|
/* eslint-enable react-hooks/exhaustive-deps */
|
|
280
282
|
|
|
281
|
-
const state = useStore(asyncBatcher.store, selector)
|
|
283
|
+
const state = useStore(asyncBatcher.store, selector, { equal: shallow })
|
|
282
284
|
|
|
283
285
|
return useMemo(
|
|
284
286
|
() =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { AsyncDebouncer } from '@tanstack/pacer/async-debouncer'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type { AnyAsyncFunction } from '@tanstack/pacer/types'
|
|
@@ -231,7 +231,9 @@ export function useAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}>(
|
|
|
231
231
|
selector: (state: AsyncDebouncerState<TFn>) => TSelected
|
|
232
232
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
233
233
|
}) {
|
|
234
|
-
const selected = useStore(debouncerInstance.store, props.selector
|
|
234
|
+
const selected = useStore(debouncerInstance.store, props.selector, {
|
|
235
|
+
equal: shallow,
|
|
236
|
+
})
|
|
235
237
|
|
|
236
238
|
return typeof props.children === 'function'
|
|
237
239
|
? props.children(selected)
|
|
@@ -244,7 +246,7 @@ export function useAsyncDebouncer<TFn extends AnyAsyncFunction, TSelected = {}>(
|
|
|
244
246
|
asyncDebouncer.fn = fn
|
|
245
247
|
asyncDebouncer.setOptions(mergedOptions)
|
|
246
248
|
|
|
247
|
-
const state = useStore(asyncDebouncer.store, selector)
|
|
249
|
+
const state = useStore(asyncDebouncer.store, selector, { equal: shallow })
|
|
248
250
|
|
|
249
251
|
/* eslint-disable react-hooks/exhaustive-deps -- cleanup only; runs on unmount */
|
|
250
252
|
useEffect(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { AsyncQueuer } from '@tanstack/pacer/async-queuer'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type {
|
|
@@ -252,7 +252,9 @@ export function useAsyncQueuer<TValue, TSelected = {}>(
|
|
|
252
252
|
selector: (state: AsyncQueuerState<TValue>) => TSelected
|
|
253
253
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
254
254
|
}) {
|
|
255
|
-
const selected = useStore(queuerInstance.store, props.selector
|
|
255
|
+
const selected = useStore(queuerInstance.store, props.selector, {
|
|
256
|
+
equal: shallow,
|
|
257
|
+
})
|
|
256
258
|
|
|
257
259
|
return typeof props.children === 'function'
|
|
258
260
|
? props.children(selected)
|
|
@@ -278,7 +280,7 @@ export function useAsyncQueuer<TValue, TSelected = {}>(
|
|
|
278
280
|
}, [])
|
|
279
281
|
/* eslint-enable react-hooks/exhaustive-deps */
|
|
280
282
|
|
|
281
|
-
const state = useStore(asyncQueuer.store, selector)
|
|
283
|
+
const state = useStore(asyncQueuer.store, selector, { equal: shallow })
|
|
282
284
|
|
|
283
285
|
return useMemo(
|
|
284
286
|
() =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { AsyncRateLimiter } from '@tanstack/pacer/async-rate-limiter'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type { AnyAsyncFunction } from '@tanstack/pacer/types'
|
|
@@ -252,7 +252,9 @@ export function useAsyncRateLimiter<
|
|
|
252
252
|
selector: (state: AsyncRateLimiterState<TFn>) => TSelected
|
|
253
253
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
254
254
|
}) {
|
|
255
|
-
const selected = useStore(rateLimiterInstance.store, props.selector
|
|
255
|
+
const selected = useStore(rateLimiterInstance.store, props.selector, {
|
|
256
|
+
equal: shallow,
|
|
257
|
+
})
|
|
256
258
|
|
|
257
259
|
return typeof props.children === 'function'
|
|
258
260
|
? props.children(selected)
|
|
@@ -277,7 +279,7 @@ export function useAsyncRateLimiter<
|
|
|
277
279
|
}, [])
|
|
278
280
|
/* eslint-enable react-hooks/exhaustive-deps */
|
|
279
281
|
|
|
280
|
-
const state = useStore(asyncRateLimiter.store, selector)
|
|
282
|
+
const state = useStore(asyncRateLimiter.store, selector, { equal: shallow })
|
|
281
283
|
|
|
282
284
|
return useMemo(
|
|
283
285
|
() =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { AsyncThrottler } from '@tanstack/pacer/async-throttler'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type { AnyAsyncFunction } from '@tanstack/pacer/types'
|
|
@@ -242,7 +242,9 @@ export function useAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}>(
|
|
|
242
242
|
selector: (state: AsyncThrottlerState<TFn>) => TSelected
|
|
243
243
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
244
244
|
}) {
|
|
245
|
-
const selected = useStore(throttlerInstance.store, props.selector
|
|
245
|
+
const selected = useStore(throttlerInstance.store, props.selector, {
|
|
246
|
+
equal: shallow,
|
|
247
|
+
})
|
|
246
248
|
|
|
247
249
|
return typeof props.children === 'function'
|
|
248
250
|
? props.children(selected)
|
|
@@ -255,7 +257,7 @@ export function useAsyncThrottler<TFn extends AnyAsyncFunction, TSelected = {}>(
|
|
|
255
257
|
asyncThrottler.fn = fn
|
|
256
258
|
asyncThrottler.setOptions(mergedOptions)
|
|
257
259
|
|
|
258
|
-
const state = useStore(asyncThrottler.store, selector)
|
|
260
|
+
const state = useStore(asyncThrottler.store, selector, { equal: shallow })
|
|
259
261
|
|
|
260
262
|
/* eslint-disable react-hooks/exhaustive-deps -- cleanup only; runs on unmount */
|
|
261
263
|
useEffect(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { Batcher } from '@tanstack/pacer/batcher'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type { BatcherOptions, BatcherState } from '@tanstack/pacer/batcher'
|
|
@@ -201,7 +201,9 @@ export function useBatcher<TValue, TSelected = {}>(
|
|
|
201
201
|
selector: (state: BatcherState<TValue>) => TSelected
|
|
202
202
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
203
203
|
}) {
|
|
204
|
-
const selected = useStore(batcherInstance.store, props.selector
|
|
204
|
+
const selected = useStore(batcherInstance.store, props.selector, {
|
|
205
|
+
equal: shallow,
|
|
206
|
+
})
|
|
205
207
|
|
|
206
208
|
return typeof props.children === 'function'
|
|
207
209
|
? props.children(selected)
|
|
@@ -226,7 +228,7 @@ export function useBatcher<TValue, TSelected = {}>(
|
|
|
226
228
|
}, [])
|
|
227
229
|
/* eslint-enable react-hooks/exhaustive-deps */
|
|
228
230
|
|
|
229
|
-
const state = useStore(batcher.store, selector)
|
|
231
|
+
const state = useStore(batcher.store, selector, { equal: shallow })
|
|
230
232
|
|
|
231
233
|
return useMemo(
|
|
232
234
|
() =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { Debouncer } from '@tanstack/pacer/debouncer'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type {
|
|
@@ -179,7 +179,9 @@ export function useDebouncer<TFn extends AnyFunction, TSelected = {}>(
|
|
|
179
179
|
selector: (state: DebouncerState<TFn>) => TSelected
|
|
180
180
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
181
181
|
}) {
|
|
182
|
-
const selected = useStore(debouncerInstance.store, props.selector
|
|
182
|
+
const selected = useStore(debouncerInstance.store, props.selector, {
|
|
183
|
+
equal: shallow,
|
|
184
|
+
})
|
|
183
185
|
|
|
184
186
|
return typeof props.children === 'function'
|
|
185
187
|
? props.children(selected)
|
|
@@ -204,7 +206,7 @@ export function useDebouncer<TFn extends AnyFunction, TSelected = {}>(
|
|
|
204
206
|
}, [])
|
|
205
207
|
/* eslint-enable react-hooks/exhaustive-deps */
|
|
206
208
|
|
|
207
|
-
const state = useStore(debouncer.store, selector)
|
|
209
|
+
const state = useStore(debouncer.store, selector, { equal: shallow })
|
|
208
210
|
|
|
209
211
|
return useMemo(
|
|
210
212
|
() =>
|
package/src/queuer/useQueuer.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { Queuer } from '@tanstack/pacer/queuer'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type { QueuerOptions, QueuerState } from '@tanstack/pacer/queuer'
|
|
@@ -211,7 +211,9 @@ export function useQueuer<TValue, TSelected = {}>(
|
|
|
211
211
|
selector: (state: QueuerState<TValue>) => TSelected
|
|
212
212
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
213
213
|
}) {
|
|
214
|
-
const selected = useStore(queuerInstance.store, props.selector
|
|
214
|
+
const selected = useStore(queuerInstance.store, props.selector, {
|
|
215
|
+
equal: shallow,
|
|
216
|
+
})
|
|
215
217
|
|
|
216
218
|
return typeof props.children === 'function'
|
|
217
219
|
? props.children(selected)
|
|
@@ -236,7 +238,7 @@ export function useQueuer<TValue, TSelected = {}>(
|
|
|
236
238
|
}, [])
|
|
237
239
|
/* eslint-enable react-hooks/exhaustive-deps */
|
|
238
240
|
|
|
239
|
-
const state = useStore(queuer.store, selector)
|
|
241
|
+
const state = useStore(queuer.store, selector, { equal: shallow })
|
|
240
242
|
|
|
241
243
|
return useMemo(
|
|
242
244
|
() =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { RateLimiter } from '@tanstack/pacer/rate-limiter'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type {
|
|
@@ -206,7 +206,9 @@ export function useRateLimiter<TFn extends AnyFunction, TSelected = {}>(
|
|
|
206
206
|
selector: (state: RateLimiterState) => TSelected
|
|
207
207
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
208
208
|
}) {
|
|
209
|
-
const selected = useStore(rateLimiterInstance.store, props.selector
|
|
209
|
+
const selected = useStore(rateLimiterInstance.store, props.selector, {
|
|
210
|
+
equal: shallow,
|
|
211
|
+
})
|
|
210
212
|
|
|
211
213
|
return typeof props.children === 'function'
|
|
212
214
|
? props.children(selected)
|
|
@@ -229,7 +231,7 @@ export function useRateLimiter<TFn extends AnyFunction, TSelected = {}>(
|
|
|
229
231
|
}, [])
|
|
230
232
|
/* eslint-enable react-hooks/exhaustive-deps */
|
|
231
233
|
|
|
232
|
-
const state = useStore(rateLimiter.store, selector)
|
|
234
|
+
const state = useStore(rateLimiter.store, selector, { equal: shallow })
|
|
233
235
|
|
|
234
236
|
return useMemo(
|
|
235
237
|
() =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
2
2
|
import { Throttler } from '@tanstack/pacer/throttler'
|
|
3
|
-
import { useStore } from '@tanstack/preact-store'
|
|
3
|
+
import { shallow, useStore } from '@tanstack/preact-store'
|
|
4
4
|
import { useDefaultPacerOptions } from '../provider/PacerProvider'
|
|
5
5
|
import type { Store } from '@tanstack/preact-store'
|
|
6
6
|
import type { AnyFunction } from '@tanstack/pacer/types'
|
|
@@ -184,7 +184,9 @@ export function useThrottler<TFn extends AnyFunction, TSelected = {}>(
|
|
|
184
184
|
selector: (state: ThrottlerState<TFn>) => TSelected
|
|
185
185
|
children: ((state: TSelected) => ComponentChildren) | ComponentChildren
|
|
186
186
|
}) {
|
|
187
|
-
const selected = useStore(throttlerInstance.store, props.selector
|
|
187
|
+
const selected = useStore(throttlerInstance.store, props.selector, {
|
|
188
|
+
equal: shallow,
|
|
189
|
+
})
|
|
188
190
|
|
|
189
191
|
return typeof props.children === 'function'
|
|
190
192
|
? props.children(selected)
|
|
@@ -197,7 +199,7 @@ export function useThrottler<TFn extends AnyFunction, TSelected = {}>(
|
|
|
197
199
|
throttler.fn = fn
|
|
198
200
|
throttler.setOptions(mergedOptions)
|
|
199
201
|
|
|
200
|
-
const state = useStore(throttler.store, selector)
|
|
202
|
+
const state = useStore(throttler.store, selector, { equal: shallow })
|
|
201
203
|
|
|
202
204
|
/* eslint-disable react-hooks/exhaustive-deps -- cleanup only; runs on unmount */
|
|
203
205
|
useEffect(() => {
|