Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix comments query
Brendan Allanda66b39a0ac5
diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsxindex 3a6a50987..18b01175d 100644--- a/apps/web/app/s/[videoId]/page.tsx+++ b/apps/web/app/s/[videoId]/page.tsx@@ -633,7 +633,7 @@ async function AuthorizedContent({: Promise.resolve([]);const commentsPromise = (async () => {- let toplLevelCommentId: Comment.CommentId | undefined;+ let toplLevelCommentId = Option.none<Comment.CommentId>();if (Option.isSome(replyId)) {const [parentComment] = await db()@@ -641,10 +641,13 @@ async function AuthorizedContent({.from(comments).where(eq(comments.id, replyId.value)).limit(1);- toplLevelCommentId = parentComment?.parentCommentId ?? undefined;+ toplLevelCommentId = Option.fromNullable(parentComment?.parentCommentId);}- const commentToBringToTheTop = toplLevelCommentId ?? commentId;+ const commentToBringToTheTop = Option.orElse(+ toplLevelCommentId,+ () => commentId,+ );const allComments = await db().select({@@ -663,9 +666,11 @@ async function AuthorizedContent({.leftJoin(users, eq(comments.authorId, users.id)).where(eq(comments.videoId, videoId)).orderBy(- commentToBringToTheTop- ? sql`CASE WHEN ${comments.id} = ${commentToBringToTheTop} THEN 0 ELSE 1 END, ${comments.createdAt}`- : comments.createdAt,+ Option.match(commentToBringToTheTop, {+ onSome: (commentId) =>+ sql`CASE WHEN ${comments.id} = ${commentId} THEN 0 ELSE 1 END, ${comments.createdAt}`,+ onNone: () => comments.createdAt,+ }),);return allComments;