Skip to content

Commit

Permalink
populateCache: undefined for currentData
Browse files Browse the repository at this point in the history
  • Loading branch information
chibicode committed May 13, 2022
1 parent 73e67a4 commit 1dca126
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/types.ts
Expand Up @@ -144,7 +144,7 @@ export type MutatorCallback<Data = any> = (

export type MutatorOptions<Data = any> = {
revalidate?: boolean
populateCache?: boolean | ((result: any, currentData: Data) => Data)
populateCache?: boolean | ((result: any, currentData?: Data) => Data)
optimisticData?: Data | ((currentData?: Data) => Data)
rollbackOnError?: boolean
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mutate.ts
Expand Up @@ -100,7 +100,7 @@ export const internalMutate = async <Data>(
if (populateCache) {
if (!error) {
// Transform the result into data.
if (isFunction(populateCache) && originalData) {
if (isFunction(populateCache)) {
data = populateCache(data, originalData)
}

Expand Down

0 comments on commit 1dca126

Please sign in to comment.