use cache when checking territory existence so that we don't query the server on every character input
This commit is contained in:
parent
f63d40196d
commit
452fcb3659
@ -74,7 +74,7 @@ async function subExists (name, { client, models, me, filter }) {
|
||||
let sub
|
||||
// apollo client
|
||||
if (client) {
|
||||
const { data } = await client.query({ query: SUB, variables: { sub: name }, fetchPolicy: 'no-cache' })
|
||||
const { data } = await client.query({ query: SUB, variables: { sub: name } })
|
||||
sub = data?.sub
|
||||
} else {
|
||||
sub = await models.sub.findUnique({ where: { name } })
|
||||
@ -104,6 +104,7 @@ async function subHasPostType (name, type, { client, models }) {
|
||||
if (!client && !models) {
|
||||
throw new Error('cannot check for territory')
|
||||
}
|
||||
|
||||
// apollo client
|
||||
if (client) {
|
||||
const { data } = await client.query({ query: SUB, variables: { name } })
|
||||
|
Loading…
x
Reference in New Issue
Block a user