Remove undefined values from query keys (#671)

* Remove undefined values from query keys

* Update e2e tests
This commit is contained in:
Filip Sodić 2022-07-18 14:18:06 +02:00 committed by GitHub
parent a0299febbc
commit 67562e32cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 9 deletions

View File

@ -9,8 +9,9 @@ export function useQuery(queryFn, queryFnArgs, options) {
throw new TypeError('queryFn needs to have queryCacheKey property defined.') throw new TypeError('queryFn needs to have queryCacheKey property defined.')
} }
const queryKey = queryFnArgs !== undefined ? [queryFn.queryCacheKey, queryFnArgs] : [queryFn.queryCacheKey]
return rqUseQuery({ return rqUseQuery({
queryKey: [queryFn.queryCacheKey, queryFnArgs], queryKey,
queryFn: () => queryFn(queryFnArgs), queryFn: () => queryFn(queryFnArgs),
...options ...options
}) })

View File

@ -319,7 +319,7 @@
"file", "file",
"web-app/src/queries/index.js" "web-app/src/queries/index.js"
], ],
"8510924f80b32cc0f67ca39fad9d97c4ce5d9695015da3ec8457e91a88868c78" "965368ac8e979667445031addb947baf19055df0df24656c3af4d3abdd86952b"
], ],
[ [
[ [

View File

@ -9,8 +9,9 @@ export function useQuery(queryFn, queryFnArgs, options) {
throw new TypeError('queryFn needs to have queryCacheKey property defined.') throw new TypeError('queryFn needs to have queryCacheKey property defined.')
} }
const queryKey = queryFnArgs !== undefined ? [queryFn.queryCacheKey, queryFnArgs] : [queryFn.queryCacheKey]
return rqUseQuery({ return rqUseQuery({
queryKey: [queryFn.queryCacheKey, queryFnArgs], queryKey,
queryFn: () => queryFn(queryFnArgs), queryFn: () => queryFn(queryFnArgs),
...options ...options
}) })

View File

@ -319,7 +319,7 @@
"file", "file",
"web-app/src/queries/index.js" "web-app/src/queries/index.js"
], ],
"8510924f80b32cc0f67ca39fad9d97c4ce5d9695015da3ec8457e91a88868c78" "965368ac8e979667445031addb947baf19055df0df24656c3af4d3abdd86952b"
], ],
[ [
[ [

View File

@ -9,8 +9,9 @@ export function useQuery(queryFn, queryFnArgs, options) {
throw new TypeError('queryFn needs to have queryCacheKey property defined.') throw new TypeError('queryFn needs to have queryCacheKey property defined.')
} }
const queryKey = queryFnArgs !== undefined ? [queryFn.queryCacheKey, queryFnArgs] : [queryFn.queryCacheKey]
return rqUseQuery({ return rqUseQuery({
queryKey: [queryFn.queryCacheKey, queryFnArgs], queryKey,
queryFn: () => queryFn(queryFnArgs), queryFn: () => queryFn(queryFnArgs),
...options ...options
}) })

View File

@ -340,7 +340,7 @@
"file", "file",
"web-app/src/queries/index.js" "web-app/src/queries/index.js"
], ],
"8510924f80b32cc0f67ca39fad9d97c4ce5d9695015da3ec8457e91a88868c78" "965368ac8e979667445031addb947baf19055df0df24656c3af4d3abdd86952b"
], ],
[ [
[ [

View File

@ -9,8 +9,9 @@ export function useQuery(queryFn, queryFnArgs, options) {
throw new TypeError('queryFn needs to have queryCacheKey property defined.') throw new TypeError('queryFn needs to have queryCacheKey property defined.')
} }
const queryKey = queryFnArgs !== undefined ? [queryFn.queryCacheKey, queryFnArgs] : [queryFn.queryCacheKey]
return rqUseQuery({ return rqUseQuery({
queryKey: [queryFn.queryCacheKey, queryFnArgs], queryKey,
queryFn: () => queryFn(queryFnArgs), queryFn: () => queryFn(queryFnArgs),
...options ...options
}) })

View File

@ -319,7 +319,7 @@
"file", "file",
"web-app/src/queries/index.js" "web-app/src/queries/index.js"
], ],
"8510924f80b32cc0f67ca39fad9d97c4ce5d9695015da3ec8457e91a88868c78" "965368ac8e979667445031addb947baf19055df0df24656c3af4d3abdd86952b"
], ],
[ [
[ [

View File

@ -9,8 +9,9 @@ export function useQuery(queryFn, queryFnArgs, options) {
throw new TypeError('queryFn needs to have queryCacheKey property defined.') throw new TypeError('queryFn needs to have queryCacheKey property defined.')
} }
const queryKey = queryFnArgs !== undefined ? [queryFn.queryCacheKey, queryFnArgs] : [queryFn.queryCacheKey]
return rqUseQuery({ return rqUseQuery({
queryKey: [queryFn.queryCacheKey, queryFnArgs], queryKey,
queryFn: () => queryFn(queryFnArgs), queryFn: () => queryFn(queryFnArgs),
...options ...options
}) })