Skip to content

fix: inline reactive flags in store build - #350

Merged
schiller-manuel merged 8 commits into
TanStack:mainfrom
Sheraff:fix/store-reactive-flags-tree-shaking
Aug 5, 2026
Merged

fix: inline reactive flags in store build#350
schiller-manuel merged 8 commits into
TanStack:mainfrom
Sheraff:fix/store-reactive-flags-tree-shaking

Conversation

@Sheraff

@Sheraff Sheraff commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the runtime-emitted ReactiveFlags const enum with shared numeric constants
  • update Store reactive internals to use constants that tsdown can inline
  • preserve ReactiveFlags as a type without changing runtime behavior

The generated ESM now contains numeric flag operations, and atom.js imports only createReactiveSystem from alien.js.

Results

in tanstack/router we tried updating tanstack/store to 0.11.0:

Build Gzip Initial gzip Raw Brotli
Unpatched 0.11 89,251 B 89,113 B 276,120 B 77,820 B
PR #350 preview 89,069 B 88,926 B 275,317 B 77,508 B

PR #350 gives the following deltas:

  • versus unpatched 0.11
    • -182 B gzip
    • -803 B raw
    • -312 B Brotli
  • versus the original 0.9 baseline of 89,197 B
    • -128 B gzip

Testing

  • pnpm --filter @tanstack/store build
  • pnpm --filter @tanstack/store test:build
  • pnpm --filter @tanstack/store test:types
  • pnpm --filter @tanstack/store test:lib --run
  • pnpm --filter @tanstack/store test:eslint
  • Prettier check

Summary by CodeRabbit

  • Documentation

    • Updated source links for reactive functions to point to their current definitions.
    • Corrected the documented type of InternalReadonlyAtom.flags.
  • Refactor

    • Reworked reactive flag handling without changing observable reactive behavior.
    • Exposed numeric flag constants while retaining the ReactiveFlags type.
  • Chores

    • Updated code analysis configuration to recognize the reactive system entry point.

@nx-cloud

nx-cloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit a7ccacc

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 43s View ↗
nx run-many --target=build --exclude=examples/** ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-04 23:03:52 UTC

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Sheraff, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 19df2fea-7af5-4448-adeb-09559925b1b5

📥 Commits

Reviewing files that changed from the base of the PR and between 5a18126 and a7ccacc.

📒 Files selected for processing (1)
  • .changeset/tidy-flags-shake.md
📝 Walkthrough

Walkthrough

The store replaces the runtime ReactiveFlags enum with numeric constants. Reactive modules now use those constants for state transitions. Knip configuration and reference documentation are updated accordingly.

Changes

Reactive flag constants

Layer / File(s) Summary
Define the flag contract
packages/store/src/alien.ts, packages/store/src/signal.ts, knip.json, docs/reference/functions/*, docs/reference/interfaces/InternalReadonlyAtom.md
Defines numeric flag constants, retains the ReactiveFlags type, updates the Knip entry point, and corrects documentation references.
Update propagation checks
packages/store/src/alien.ts
Uses standalone constants for propagation, dirty checking, pending clearing, and shallow propagation.
Update atom and signal transitions
packages/store/src/atom.ts, packages/store/src/signal.ts
Uses standalone constants for atom, computed, signal, effect, and effect-scope initialization, execution, cleanup, and dependency handling.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • TanStack/store#297: Updates the same tree-shaking refactor areas and generated documentation references.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the changes and testing, but it omits the required Checklist and Release Impact sections. Add the required Checklist and Release Impact sections, including checklist confirmations and whether a changeset is required.
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: inlining reactive flags in the Store build.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026

Copy link
Copy Markdown
@tanstack/angular-store

npm i https://pkg.pr.new/@tanstack/angular-store@350

@tanstack/lit-store

npm i https://pkg.pr.new/@tanstack/lit-store@350

@tanstack/octane-store

npm i https://pkg.pr.new/@tanstack/octane-store@350

@tanstack/preact-store

npm i https://pkg.pr.new/@tanstack/preact-store@350

@tanstack/react-store

npm i https://pkg.pr.new/@tanstack/react-store@350

@tanstack/solid-store

npm i https://pkg.pr.new/@tanstack/solid-store@350

@tanstack/store

npm i https://pkg.pr.new/@tanstack/store@350

@tanstack/svelte-store

npm i https://pkg.pr.new/@tanstack/svelte-store@350

@tanstack/vue-store

npm i https://pkg.pr.new/@tanstack/vue-store@350

commit: a7ccacc

@schiller-manuel
schiller-manuel merged commit 1d7c87e into TanStack:main Aug 5, 2026
9 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 5, 2026
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.

3 participants