๐ Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support
by vuejsTypeScript
Last 12 weeks ยท 21 commits
6 of 6 standards met
Problem When a setup store has a state property and is called with a plain object, deep-merges into the shallowRef's inner value in-place. Because only tracks reference identity (not deep property mutations), dependent reactive effects (watchers, , computed, etc.) never re-run โ even though the data was correctly updated in the store. Reported in #2861. The maintainer confirmed the fix direction: call when a shallow-ref-backed property is patched. Reproduction Fix After mutates the shallowRef's inner value in-place, retrieve the raw backing ref via and check + . If both are true, call to force dependent effects to re-run. Changed files: โ add / imports + the call in โ new regression tests (RED โ GREEN) Verification No existing test edited. AI-assisted contribution. Closes #2861 Summary by CodeRabbit Bug Fixes** Fixed updates for state stored in shallow reactive references, so nested changes now reliably update the store. Improved reactivity after patching nested objects, ensuring dependent views and effects refresh as expected. Added regression coverage to protect this behavior in future releases.
Summary remove top-level state keys that are not present in the initial options-store state when runs add a focused regression test covering an added key left behind by Closes #3145 Tests Summary by CodeRabbit Bug Fixes Resetting a setup store now fully restores its original state shape, removing any extra state keys that were added dynamically. State reset updates are grouped more cleanly, so the reset behaves consistently as a single change. Tests Added coverage to verify that dynamically added state is cleared when a store is reset.
Reproduction For an options store with initial state , add a top-level state key at runtime and then call : Expected behavior restores the store state to the initial state shape, so is removed. Actual behavior remains in after because the reset implementation only assigns initial keys over the current state and never deletes keys missing from the initial state. Verification Added a focused regression test in that fails before the fix and passes after deleting non-initial keys during .
Summary Treat promise-like action returns as async results for subscribers. Use to assimilate thenables before triggering or hooks. Add coverage for native promises, custom thenables, rejected thenables, and cross-realm promises. Root cause The action wrapper only checked , so promise-like objects and promises created in another realm skipped the async hook path. That meant could receive the unresolved object and could miss rejected thenables. Validation Summary by CodeRabbit Release Notes Bug Fixes Improved action subscription handling to properly recognize and normalize promise-like return values, ensuring consistent behavior across different Promise implementations and contexts. Tests Expanded test coverage for action return and rejection handling with custom thenables and cross-realm Promises.
Repository: vuejs/pinia. Description: ๐ Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support Stars: 14628, Forks: 1186. Primary language: TypeScript. Languages: TypeScript (77.7%), Vue (18.1%), CSS (1.8%), JavaScript (1.8%), HTML (0.5%). License: MIT. Homepage: https://pinia.vuejs.org Topics: composition-api, ssr, store, vue, vuex. Latest release: v3.0.4 (7mo ago). Open PRs: 12, open issues: 17. Last activity: 2d ago. Community health: 100%. Top contributors: posva, dependabot[bot], dependabot-preview[bot], renovate-bot, pi0, renovate[bot], nicodevs, danielroe, idorenyinudoh, skirtles-code and others.