Skip to content

Commit 2cfd03b

Browse files
authored
Tolerate nullable has_notes field when fetching LeetCode submissions (#516)
1 parent 771546d commit 2cfd03b

File tree

1 file changed

+5
-1
lines changed
  • workspaces/leetcode-api/src/api/submission-list-non-graphql

1 file changed

+5
-1
lines changed

workspaces/leetcode-api/src/api/submission-list-non-graphql/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ const submissionZodType = (() => {
6868
// eslint-disable-next-line camelcase
6969
title_slug: slugZodType,
7070
// eslint-disable-next-line camelcase
71-
has_notes: z.boolean(),
71+
has_notes: z
72+
.boolean()
73+
// The `has_notes` field can sometimes come back null, see for example submission 1201108107 which has an auto-generated note.
74+
.nullable()
75+
.transform((val) => val ?? true),
7276
// eslint-disable-next-line camelcase
7377
flag_type: int,
7478
})

0 commit comments

Comments
 (0)