Skip to content

Commit

Permalink
Merge pull request #47 from GoodbyeNJN/main
Browse files Browse the repository at this point in the history
feat: support persist name is different from store name
  • Loading branch information
zbeyens authored Sep 8, 2022
2 parents 805cd0f + ac2379c commit 3a1fc40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wet-grapes-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@udecode/zustood": patch
---

feat: support persist name is different from store name
7 changes: 6 additions & 1 deletion packages/zustood/src/createStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ export const createStore =
const middlewares: any[] = [immerMiddleware, ..._middlewares];

if (persist?.enabled) {
const options = {
...persist,
name: persist.name ?? name,
};

middlewares.push((config: any) =>
persistMiddleware(config, { ...persist, name } as any)
persistMiddleware(config, options as any)
);
}

Expand Down

0 comments on commit 3a1fc40

Please sign in to comment.