use cache when checking territory existence so that we don't query the server on every character input

This commit is contained in:
k00b 2025-07-22 18:44:42 -05:00
parent f63d40196d
commit 452fcb3659

View File

@ -74,7 +74,7 @@ async function subExists (name, { client, models, me, filter }) {
let sub let sub
// apollo client // apollo client
if (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 sub = data?.sub
} else { } else {
sub = await models.sub.findUnique({ where: { name } }) sub = await models.sub.findUnique({ where: { name } })
@ -104,6 +104,7 @@ async function subHasPostType (name, type, { client, models }) {
if (!client && !models) { if (!client && !models) {
throw new Error('cannot check for territory') throw new Error('cannot check for territory')
} }
// apollo client // apollo client
if (client) { if (client) {
const { data } = await client.query({ query: SUB, variables: { name } }) const { data } = await client.query({ query: SUB, variables: { name } })