Skip to content

Commit 2715e0f

Browse files
authored
fix(races): Language options is optional for graphql (#807)
## What does this do? Fixes the GraphQL resolver to handle `language_options` being optional on races. ## How was it tested? Locally ## Is there a Github issue this is resolving? Raised in the Discord ## Here's a fun image for your troubles ![image](https://github.com/user-attachments/assets/6837b7fb-533a-47a6-ae6c-9856fc04932c)
1 parent bc5dc06 commit 2715e0f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/graphql/2014/utils/resolvers.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ import {
1616
ReferenceOption
1717
} from '@/models/common/choice'
1818

19-
export async function resolveLanguageChoice(choiceData: Choice): Promise<LanguageChoice | null> {
19+
export async function resolveLanguageChoice(
20+
choiceData: Choice | null
21+
): Promise<LanguageChoice | null> {
2022
const gqlEmbeddedOptions: LanguageChoiceOption[] = []
2123

24+
if (!choiceData) {
25+
return null
26+
}
27+
2228
if (choiceData.from.option_set_type === 'resource_list') {
2329
const allItems = (await LanguageModel.find({}).lean()) as Language[]
2430
for (const item of allItems) {

0 commit comments

Comments
 (0)