Skip to content

Commit

Permalink
feat: support persist name is different from store name
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodbyeNJN committed Sep 8, 2022
1 parent 805cd0f commit 3483028
Showing 1 changed file with 6 additions and 1 deletion.
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 3483028

Please sign in to comment.