diff --git a/apps/client/src/features/api-key/components/create-api-key-modal.tsx b/apps/client/src/features/api-key/components/create-api-key-modal.tsx
index d9c993f4a8..627286b1c2 100644
--- a/apps/client/src/features/api-key/components/create-api-key-modal.tsx
+++ b/apps/client/src/features/api-key/components/create-api-key-modal.tsx
@@ -57,7 +57,7 @@ export default function CreateApiKeyModal() {
let expiresAt: string | undefined;
if (values.expiration === "custom" && values.customDate) {
- expiresAt = values.customDate.toISOString();
+ expiresAt = new Date(values.customDate).toISOString();
} else if (values.expiration !== "never") {
const days = parseInt(values.expiration, 10);
expiresAt = new Date(Date.now() + days * 24 * 60 * 60 * 1000).toISOString();
@@ -106,7 +106,7 @@ export default function CreateApiKeyModal() {
diff --git a/apps/client/src/features/comment/queries/comment-query.ts b/apps/client/src/features/comment/queries/comment-query.ts
index 076630e573..669d51e501 100644
--- a/apps/client/src/features/comment/queries/comment-query.ts
+++ b/apps/client/src/features/comment/queries/comment-query.ts
@@ -67,15 +67,20 @@ export function useCreateCommentMutation() {
) as InfiniteData> | undefined;
if (cache && cache.pages.length > 0) {
- const lastIdx = cache.pages.length - 1;
- queryClient.setQueryData(RQ_KEY(newComment.pageId), {
- ...cache,
- pages: cache.pages.map((page, i) =>
- i === lastIdx
- ? { ...page, items: [...page.items, newComment] }
- : page,
- ),
- });
+ const alreadyExists = cache.pages.some((page) =>
+ page.items.some((c) => c.id === newComment.id),
+ );
+ if (!alreadyExists) {
+ const lastIdx = cache.pages.length - 1;
+ queryClient.setQueryData(RQ_KEY(newComment.pageId), {
+ ...cache,
+ pages: cache.pages.map((page, i) =>
+ i === lastIdx
+ ? { ...page, items: [...page.items, newComment] }
+ : page,
+ ),
+ });
+ }
}
notifications.show({ message: t("Comment created successfully") });