Skip to content

feat: add actions to stores#307

Open
KevinVandy wants to merge 4 commits intohooksfrom
actions
Open

feat: add actions to stores#307
KevinVandy wants to merge 4 commits intohooksfrom
actions

Conversation

@KevinVandy
Copy link
Copy Markdown
Member

🎯 Changes

Add optional typed actions to @tanstack/store writable stores and wire the React adapter/examples up to that new API.

What Changed

  • Added an optional second argument to createStore(initialValue, actionsFactory) for writable stores.
  • Extended Store to support typed actions bags via Store<T, TActions = never>.
  • Kept derived store behavior unchanged: createStore(fn) still returns a readonly derived store.
  • Enforced at the type level that action maps only contain functions.
  • Added useStoreActions to @tanstack/react-store.
  • Updated useCreateStore and React store hook typings to support stores with actions.

Notes

  • No runtime validation was added for invalid action shapes; this is enforced via types only.
  • createStore(fn, actions) remains unsupported at the type level so function-first-arg keeps its existing readonly-derived meaning.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 11, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b77dd356-d227-4254-99b6-4882030123af

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch actions

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 and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 11, 2026

View your CI Pipeline Execution ↗ for commit e7a7a17

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

☁️ Nx Cloud last updated this comment at 2026-04-12 16:44:46 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 11, 2026

🚀 Changeset Version Preview

7 package(s) bumped directly, 0 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/angular-store 0.10.0 → 0.11.0 Changeset
@tanstack/preact-store 0.12.0 → 0.13.0 Changeset
@tanstack/react-store 0.10.0 → 0.11.0 Changeset
@tanstack/solid-store 0.10.0 → 0.11.0 Changeset
@tanstack/store 0.10.0 → 0.11.0 Changeset
@tanstack/svelte-store 0.11.0 → 0.12.0 Changeset
@tanstack/vue-store 0.10.0 → 0.11.0 Changeset

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 11, 2026

@tanstack/angular-store

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

@tanstack/preact-store

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

@tanstack/react-store

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

@tanstack/solid-store

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

@tanstack/store

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

@tanstack/svelte-store

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

@tanstack/vue-store

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

commit: e7a7a17

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.

1 participant