diff --git a/packages/query-core/src/query.ts b/packages/query-core/src/query.ts index 8b8b5ecabd..3b3960e900 100644 --- a/packages/query-core/src/query.ts +++ b/packages/query-core/src/query.ts @@ -354,8 +354,8 @@ export class Query< } } - if (!Array.isArray(this.options.queryKey)) { - if (process.env.NODE_ENV !== 'production') { + if (process.env.NODE_ENV !== 'production') { + if (!Array.isArray(this.options.queryKey)) { this.logger.error( `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`, )