pinia-react 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +2 -4
  2. package/package.json +4 -2
package/dist/index.js CHANGED
@@ -93,9 +93,7 @@ function defineStore(id, options) {
93
93
  }
94
94
  };
95
95
  pinia._state.set(id, $state);
96
- const store = reactive(Object.assign(baseStore, toRefs($state), Object.keys(actions ?? []).reduce((x, y) => Object.assign(x, { [y]: function(...args) {
97
- return actions[y].call(store, ...args);
98
- } }), {}), Object.keys(getters || {}).reduce((computedGetters, name) => {
96
+ const store = reactive(Object.assign(baseStore, toRefs($state), Object.keys(actions ?? []).reduce((x, y) => Object.assign(x, { [y]: (...args) => actions[y].call(store, ...args) }), {}), Object.keys(getters || {}).reduce((computedGetters, name) => {
99
97
  computedGetters[name] = markRaw(computed(() => {
100
98
  return getters?.[name].call(store, store);
101
99
  }));
@@ -130,7 +128,7 @@ function defineStore(id, options) {
130
128
  effectMap.delete(_id.current);
131
129
  };
132
130
  }, []);
133
- useSyncExternalStore(subscribe, () => storeSnapshotRef.current, () => ({ ...store }));
131
+ useSyncExternalStore(subscribe, () => storeSnapshotRef.current, () => storeSnapshotRef.current);
134
132
  let effect = effectMap.get(_id.current);
135
133
  if (!effect) {
136
134
  const fn = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinia-react",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "homepage": "https://github.com/savageKarl/pinia-react#readme",
6
6
  "bugs": {
@@ -28,7 +28,8 @@
28
28
  "prepare": "npx simple-git-hooks",
29
29
  "build": "tsdown",
30
30
  "dev": "tsdown --watch",
31
- "playground": "vite --config playground/vite.config.ts",
31
+ "playground-react": "vite --config playground/react/vite.config.ts",
32
+ "playground-nextjs": "pnpm next dev ./playground/nextjs",
32
33
  "test": "vitest",
33
34
  "semantic-release": "semantic-release",
34
35
  "format": "pnpm exec biome check --write"
@@ -61,6 +62,7 @@
61
62
  "@types/react-dom": "^19.1.4",
62
63
  "@vitejs/plugin-react": "^5.0.0",
63
64
  "jsdom": "^26.1.0",
65
+ "next": "^15.4.6",
64
66
  "semantic-release": "^24.2.7",
65
67
  "simple-git-hooks": "^2.13.1",
66
68
  "tsdown": "^0.13.3",