Skip to content

Commit

Permalink
Version Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 4, 2025
1 parent 03d1216 commit 6ef9335
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 52 deletions.
51 changes: 0 additions & 51 deletions .changeset/beige-cows-bake.md

This file was deleted.

52 changes: 52 additions & 0 deletions packages/zustand-x/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
# @udecode/zustood

## 6.0.0

### Major Changes

- [#100](https://github.com/udecode/zustand-x/pull/100) by [@zbeyens](https://github.com/zbeyens) – The store hooks are now part of the public API. Previously accessible only through the `store` object, they are now available as standalone hooks to ensure compatibility with the new React Compiler. Added standalone hooks: `useStoreValue`, `useStoreState`, `useTracked`, `useTrackedStore`.

We're moving away from object namespaces like `use`, `get`, `set` to a more functional approach where the first argument is the store state field. This includes the extended selectors and actions, where the parameters follow the first argument. This change simplifies the API and makes it more consistent with React hooks. Instead of accessing state through object properties (`store.use.name()`), we now use functions with the state field as the first argument (`store.useValue('name')`).

Migration cases:

```ts
// Before: store.use.name(), store.use.extendedSelector(1, 2, (a, b) => a === b)
useStoreValue(store, 'name');
useStoreValue(store, 'extendedSelector', 1, 2, (a, b) => a === b);
// Equivalent to
store.useValue('name');
store.useValue('extendedSelector', 1, 2, (a, b) => a === b);

// Before: store.useTracked.name()
useTracked(store, 'name');
// Equivalent to
store.useTracked('name');

// Before: store.get.name(), store.get.extendedSelector(1, 2), store.get.state()
store.get('name');
store.get('extendedSelector', 1, 2);
store.get('state');

// Before: store.set.name('value'), store.set.extendedAction(1, 2), store.set.state(draft => { ... })
store.set('name', 'value');
store.set('extendedAction', 1, 2);
store.set('state', (draft) => {});

// Before: store.extendSelectors((set, get, api) => ({ ... })). Now only api argument that you can destructure.
store.extendSelectors(({ get }) => ({ ... }));

// Before: store.extendActions((set, get, api) => ({ ... })). Now only api argument that you can destructure.
store.extendActions(({ set }) => ({ ... }));
```

- Remove `mapValuesKey`. This would be the equivalent:

```ts
const stores = {
auth: authStore,
combobox: comboboxStore,
};

useValue(stores.auth, 'name');
useValue(stores.combobox, 'name');
```

## 5.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/zustand-x/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zustand-x",
"version": "5.0.1",
"version": "6.0.0",
"description": "Zustand store factory for a best-in-class developer experience.",
"license": "MIT",
"homepage": "https://zustand-x.udecode.dev",
Expand Down

0 comments on commit 6ef9335

Please sign in to comment.