Skip to content

feat: add actions to stores#307

Merged
KevinVandy merged 5 commits intohooksfrom
actions
Apr 14, 2026
Merged

feat: add actions to stores#307
KevinVandy merged 5 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: 9093eb1a-e692-42b4-b110-b515d5bebfbd

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 ca743bc

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

☁️ Nx Cloud last updated this comment at 2026-04-14 18:12:42 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: ca743bc

autofix-ci bot and others added 4 commits April 11, 2026 19:45
)

* feat: introduce more frameworks hooks for other non-react adapters

* new changeset

* ci: apply automated fixes and generate docs

* remove dedicated setValue and useAction hooks. Add new useStore hooks with _

* ci: apply automated fixes and generate docs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@KevinVandy KevinVandy merged commit 92ec178 into hooks Apr 14, 2026
7 checks passed
@KevinVandy KevinVandy deleted the actions branch April 14, 2026 18:13
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