From 0054f7ffff712bafd8fbf44aaba23afba85d350d Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Wed, 24 Jun 2020 19:35:07 -0600 Subject: [PATCH] fix(prefetchQuery): add prefetchQuery(key, options) overload --- src/queryCache.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/queryCache.js b/src/queryCache.js index 97dd568cbf..c904729e00 100644 --- a/src/queryCache.js +++ b/src/queryCache.js @@ -13,6 +13,7 @@ import { uid, statusIdle, Console, + isObject, } from './utils' import { defaultConfigRef } from './config' @@ -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 {