Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
soc221b committed Dec 15, 2024
1 parent 609fc9a commit 64ce13a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StateTree, SubscriptionCallback } from 'pinia'
import { UnwrapRef } from 'vue'

export interface IStorage {
getItem: (key: string) => any | Promise<any>
Expand Down Expand Up @@ -47,7 +48,7 @@ export interface CommonOptions<S extends StateTree = StateTree> {
*
* @default (state, savedState) => savedState
*/
merge?: (state: S, savedState: S) => S
merge?: (state: S, savedState: UnwrapRef<S>) => UnwrapRef<S>

/**
* When rehydrating, overwrite initial state (patch otherwise).
Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ describe('hydrate', () => {
{
persistedState: {
merge: (state, savedState) => {
return { values: [...state.values, ...savedState.values] }
return { values: [...state.values.value, ...savedState.values] }
},
},
},
Expand Down

0 comments on commit 64ce13a

Please sign in to comment.