From e41bc61dfe2505d9033e7ea2ae42b99d22655c66 Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Thu, 28 Dec 2023 01:29:10 +0700 Subject: [PATCH 1/4] fix: better logic for hasMore --- src/services/datahub/posts/query.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/datahub/posts/query.ts b/src/services/datahub/posts/query.ts index 2b4d5fb48..16501c59c 100644 --- a/src/services/datahub/posts/query.ts +++ b/src/services/datahub/posts/query.ts @@ -88,7 +88,7 @@ async function getPaginatedPostsByRootPostId({ return id }) const totalData = res.findPosts.total ?? 0 - const hasMore = res.findPosts.data.length > 0 + const hasMore = offset + ids.length < totalData const idsSet = new Set(ids) From 3738f60e19d62a62c7f4e9f673684d9e7ad3f02f Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Thu, 28 Dec 2023 01:41:27 +0700 Subject: [PATCH 2/4] chore: update error title --- src/components/chats/ChatForm.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/chats/ChatForm.tsx b/src/components/chats/ChatForm.tsx index 8389c1e14..aea4400dc 100644 --- a/src/components/chats/ChatForm.tsx +++ b/src/components/chats/ChatForm.tsx @@ -114,12 +114,10 @@ export default function ChatForm({ const { mutate: requestTokenAndSendMessage } = useRequestTokenAndSendMessage({ onSuccess: () => unsentMessageStorage.remove(chatId), onError: (error, variables) => { - showErrorSendingMessageToast( - error, - 'Failed to register or send message', - variables, - { reloadUnsentMessage, setIsDisabledInput } - ) + showErrorSendingMessageToast(error, 'Failed to send message', variables, { + reloadUnsentMessage, + setIsDisabledInput, + }) }, }) From debb8debe8b231fb69bcf55e86c6107ac5cd60fb Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Thu, 28 Dec 2023 01:43:03 +0700 Subject: [PATCH 3/4] chore: remove error message from error toast --- src/hooks/useToastError.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/hooks/useToastError.tsx b/src/hooks/useToastError.tsx index 5e237d31d..3a9536f26 100644 --- a/src/hooks/useToastError.tsx +++ b/src/hooks/useToastError.tsx @@ -13,14 +13,15 @@ export function showErrorToast( } ) { const { actionButton, getMessage, toastConfig } = config ?? {} - let message: string | undefined = (error as any)?.message + // TODO: this error message should be sent to logger for debugging purposes, but not shown to user + // let message: string | undefined = (error as any)?.message - const response = (error as any)?.response?.data - message = response?.message ?? message - if (getMessage) { - const responseMessage = getMessage(response) - if (responseMessage) message = responseMessage - } + // const response = (error as any)?.response?.data + // message = response?.message ?? message + // if (getMessage) { + // const responseMessage = getMessage(response) + // if (responseMessage) message = responseMessage + // } toast.custom( (t) => ( @@ -28,7 +29,7 @@ export function showErrorToast( t={t} type='error' title={errorTitle} - subtitle={message} + // subtitle={message} description={config?.getDescription?.(t)} action={actionButton?.(t)} /> From 9fb989b458e84d0ff2d633de4240eafbf3cfcbc6 Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Thu, 28 Dec 2023 01:43:49 +0700 Subject: [PATCH 4/4] chore: increment version --- src/pages/api/version.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/api/version.ts b/src/pages/api/version.ts index 0d0a5c4b9..aa0d30e17 100644 --- a/src/pages/api/version.ts +++ b/src/pages/api/version.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -const VERSION = '19' +const VERSION = '20' export default function handler(_: NextApiRequest, res: NextApiResponse) { res.status(200).json(VERSION)