Skip to content

Commit

Permalink
Merge pull request #510 from dappforce/deploy/fixes
Browse files Browse the repository at this point in the history
Minor Improvements
  • Loading branch information
olehmell authored Dec 27, 2023
2 parents aa9b311 + 9fb989b commit 8dcdb3e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
10 changes: 4 additions & 6 deletions src/components/chats/ChatForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
},
})

Expand Down
17 changes: 9 additions & 8 deletions src/hooks/useToastError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@ export function showErrorToast<ErrorType>(
}
) {
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) => (
<CustomToast
t={t}
type='error'
title={errorTitle}
subtitle={message}
// subtitle={message}
description={config?.getDescription?.(t)}
action={actionButton?.(t)}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/version.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/services/datahub/posts/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>(ids)

Expand Down

0 comments on commit 8dcdb3e

Please sign in to comment.