Skip to content

Commit 0054f7f

Browse files
committed
fix(prefetchQuery): add prefetchQuery(key, options) overload
1 parent 340e4ad commit 0054f7f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/queryCache.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
uid,
1414
statusIdle,
1515
Console,
16+
isObject,
1617
} from './utils'
1718
import { defaultConfigRef } from './config'
1819

@@ -219,6 +220,15 @@ export function makeQueryCache({ frozen = isServer, defaultConfig } = {}) {
219220
}
220221

221222
queryCache.prefetchQuery = async (...args) => {
223+
if (
224+
(isObject(args[1]) && args[1].hasOwnProperty('throwOnError')) ||
225+
args[1].hasOwnProperty('force')
226+
) {
227+
args[3] = args[1]
228+
args[1] = undefined
229+
args[2] = undefined
230+
}
231+
222232
let [queryKey, config, { force, throwOnError } = {}] = getQueryArgs(args)
223233

224234
try {

0 commit comments

Comments
 (0)