diff --git a/packages/zustood/src/createStore.ts b/packages/zustood/src/createStore.ts index 7dde13c..09ef8d8 100644 --- a/packages/zustood/src/createStore.ts +++ b/packages/zustood/src/createStore.ts @@ -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) ); }