Skip to content

Commit

Permalink
fix(prefetchQuery): add prefetchQuery(key, options) overload
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Jun 25, 2020
1 parent 340e4ad commit 0054f7f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/queryCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
uid,
statusIdle,
Console,
isObject,
} from './utils'
import { defaultConfigRef } from './config'

Expand Down Expand Up @@ -219,6 +220,15 @@ export function makeQueryCache({ frozen = isServer, defaultConfig } = {}) {
}

queryCache.prefetchQuery = async (...args) => {
if (
(isObject(args[1]) && args[1].hasOwnProperty('throwOnError')) ||
args[1].hasOwnProperty('force')
) {
args[3] = args[1]
args[1] = undefined
args[2] = undefined
}

let [queryKey, config, { force, throwOnError } = {}] = getQueryArgs(args)

try {
Expand Down

0 comments on commit 0054f7f

Please sign in to comment.