Skip to content

Commit a6b6c85

Browse files
committed
Tolerate nullable has_notes field when fetching LeetCode submissions
1 parent 771546d commit a6b6c85

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ const submissionZodType = (() => {
6767
.nullable(),
6868
// eslint-disable-next-line camelcase
6969
title_slug: slugZodType,
70+
// The `has_notes` field can sometimes come back null, see for example submission 1201108107 which has an auto-generated note.
7071
// eslint-disable-next-line camelcase
71-
has_notes: z.boolean(),
72+
has_notes: z.boolean().nullable().transform(val => val ?? true),
7273
// eslint-disable-next-line camelcase
7374
flag_type: int,
7475
})

0 commit comments

Comments
 (0)