Skip to content

fix: rename executeCount to executionCount in AsyncBatcherState and AsyncQueuerState - #254

Open
manudeli wants to merge 1 commit into
TanStack:mainfrom
manudeli:fix-unify-execution-count-naming
Open

fix: rename executeCount to executionCount in AsyncBatcherState and AsyncQueuerState#254
manudeli wants to merge 1 commit into
TanStack:mainfrom
manudeli:fix-unify-execution-count-naming

Conversation

@manudeli

@manudeli manudeli commented Aug 20, 2026

Copy link
Copy Markdown

Fixes #253

What

Renames executeCountexecutionCount in AsyncBatcherState and AsyncQueuerState, the only two state interfaces that diverged from the executionCount name used everywhere else (BatcherState, QueuerState, DebouncerState, ThrottlerState, RateLimiterState, AsyncRetryerState).

Pure rename — no behavior change. The counter still increments at execution start and still serves as the key for the internal asyncRetryers map and getAbortSignal().

Changes

  • packages/pacer/src/async-batcher.ts, async-queuer.ts: state field, getAbortSignal(executionCount?) parameter, internal locals, and TSDoc. Also fixed the circular AsyncBatcher field comment ("executions that have been executed" → "executions that have been started", matching the actual increment timing).
  • Framework guide docs (async-batching / async-queuing × react, preact, solid, angular, vanilla).
  • Regenerated reference docs via pnpm generate-docs (only AsyncBatcher/AsyncQueuer pages changed).
  • Changeset: minor for @tanstack/pacer, with the rename called out as breaking in the changelog entry.

maybeExecuteCount fields are untouched — they're named after the maybeExecute method, which is a different convention.

Verification

  • pnpm test (vitest): 555/555 pass in @tanstack/pacer; nx affected --targets=test:lib,test:types green across all 10 packages.
  • grep -rn executeCount across packages/docs/examples returns no remaining references (excluding maybeExecuteCount).

Notes for review

  • This is technically breaking for anyone reading state.executeCount (selectors, initialState, devtools-adjacent code). Since Pacer is pre-1.0 I've marked it minor per 0.x semver — happy to adjust if you'd rather stage a deprecation alias instead.

Follow-up idea (not in this PR): guard against future naming drift with a type test

This divergence went unnoticed because nothing ties the sync and async state interfaces together — they're deliberately independent declarations (which keeps the interfaces flat and doc-generation friendly, so I'm not proposing extends). A lightweight alternative that keeps that structure intact: a type-level test asserting that the fields shared between counterpart interfaces keep the same names, e.g.

// compile error if a shared field is renamed on only one side
type SharedBatcherKeys = 'executionCount' | 'isEmpty' | 'isPending' | 'items' | 'size' | 'totalItemsProcessed'
assertType<SharedBatcherKeys extends keyof AsyncBatcherState<unknown> ? true : false>(true)
assertType<SharedBatcherKeys extends keyof BatcherState<unknown> ? true : false>(true)

If maintainers think it's worthwhile, I'd be happy to add such tests for all sync/async counterpart pairs in a follow-up PR.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Breaking Changes

    • Renamed the async batching and queuing execution counter from executeCount to executionCount.
    • Renamed the optional getAbortSignal parameter to executionCount.
    • Update integrations that reference the previous property or parameter name.
  • Documentation

    • Updated async batching, queuing, and API reference guides across supported frameworks.
    • Clarified that omitting the execution count selects the most recent execution.

…nd AsyncQueuerState

Unifies counter naming with all other utilities (BatcherState, QueuerState,
DebouncerState, ThrottlerState, RateLimiterState, AsyncRetryerState), which
all use `executionCount`. Pure rename, no behavior change.

Fixes TanStack#253

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a176bff3-79cd-4289-83c6-cc6eb2082c8a

📥 Commits

Reviewing files that changed from the base of the PR and between e063ad7 and 4218c22.

📒 Files selected for processing (17)
  • .changeset/unify-execution-count-naming.md
  • docs/framework/angular/guides/async-batching.md
  • docs/framework/angular/guides/async-queuing.md
  • docs/framework/preact/guides/async-batching.md
  • docs/framework/preact/guides/async-queuing.md
  • docs/framework/react/guides/async-batching.md
  • docs/framework/react/guides/async-queuing.md
  • docs/framework/solid/guides/async-batching.md
  • docs/framework/solid/guides/async-queuing.md
  • docs/framework/vanilla/guides/async-batching.md
  • docs/framework/vanilla/guides/async-queuing.md
  • docs/reference/classes/AsyncBatcher.md
  • docs/reference/classes/AsyncQueuer.md
  • docs/reference/interfaces/AsyncBatcherState.md
  • docs/reference/interfaces/AsyncQueuerState.md
  • packages/pacer/src/async-batcher.ts
  • packages/pacer/src/async-queuer.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Renames async batcher and queuer execution counters and getAbortSignal parameters from executeCount to executionCount. Updates source code, reference documentation, framework guides, and the changeset. Execution behavior remains unchanged.

Changes

Async execution counter naming

Layer / File(s) Summary
Core counter and abort-signal rename
packages/pacer/src/async-batcher.ts, packages/pacer/src/async-queuer.ts, .changeset/unify-execution-count-naming.md
Renames state counters, execution tracking identifiers, retryer keys, and getAbortSignal parameters to executionCount.
Public reference documentation
docs/reference/classes/AsyncBatcher.md, docs/reference/classes/AsyncQueuer.md, docs/reference/interfaces/AsyncBatcherState.md, docs/reference/interfaces/AsyncQueuerState.md
Updates public signatures and state property documentation to use executionCount.
Framework guide updates
docs/framework/*/guides/async-batching.md, docs/framework/*/guides/async-queuing.md
Updates Angular, Preact, React, Solid, and Vanilla examples to use executionCount.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 4218c

This PR consistently renames the async state field and related documentation without changing execution behavior; no actionable merge-blocking risk remains.

Possibly related PRs

  • TanStack/pacer#246: Both PRs modify async queuer execution tracking and abort-signal-related state.

Suggested reviewers: kevinvandy

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR satisfies issue #253 by renaming both state fields and related references, updating documentation, preserving behavior, and adding the minor breaking-change changeset.
Out of Scope Changes check ✅ Passed The changes remain within issue #253, including source references, documentation, generated reference pages, comments, and the required changeset.
Title check ✅ Passed The title clearly and concisely identifies the main change: renaming executeCount to executionCount in both async state interfaces.
Description check ✅ Passed The description clearly covers the change, motivation, affected documentation, testing, release impact, and breaking rename details.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent counter naming: executeCount (AsyncBatcher, AsyncQueuer) vs executionCount (everywhere else)

1 participant