mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-05 21:04:43 +08:00
🐛 Fix network error toast showing up in some scenario even if no error was returned
This commit is contained in:
parent
8432b5b5a0
commit
06d82ad347
4
bun.lock
4
bun.lock
@ -607,7 +607,7 @@
|
||||
},
|
||||
"packages/embeds/js": {
|
||||
"name": "@typebot.io/js",
|
||||
"version": "0.8.12",
|
||||
"version": "0.8.13",
|
||||
"devDependencies": {
|
||||
"@ai-sdk/ui-utils": "1.2.2",
|
||||
"@ark-ui/solid": "5.11.0",
|
||||
@ -645,7 +645,7 @@
|
||||
},
|
||||
"packages/embeds/react": {
|
||||
"name": "@typebot.io/react",
|
||||
"version": "0.8.12",
|
||||
"version": "0.8.13",
|
||||
"dependencies": {
|
||||
"@typebot.io/js": "workspace:*",
|
||||
"react": "18.3.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/js",
|
||||
"version": "0.8.12",
|
||||
"version": "0.8.13",
|
||||
"description": "Javascript library to display typebots on your website",
|
||||
"license": "FSL-1.1-ALv2",
|
||||
"type": "module",
|
||||
|
||||
@ -218,10 +218,6 @@ export const ChatContainer = (props: Props) => {
|
||||
setIsSending(false);
|
||||
|
||||
await processContinueChatResponse({ data, error });
|
||||
|
||||
if (!navigator.onLine || isNetworkError(error as Error)) {
|
||||
showOfflineErrorToast();
|
||||
}
|
||||
};
|
||||
|
||||
const processContinueChatResponse = async ({
|
||||
@ -229,6 +225,7 @@ export const ChatContainer = (props: Props) => {
|
||||
error,
|
||||
}: { data: ContinueChatResponse | undefined; error: unknown }) => {
|
||||
if (error) {
|
||||
if (isNetworkError(error)) showOfflineErrorToast();
|
||||
const errorLogs = [
|
||||
await parseUnknownClientError({
|
||||
err: error,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
export const isNetworkError = (error: Error) => {
|
||||
export const isNetworkError = (error: unknown) => {
|
||||
if (error instanceof TypeError) {
|
||||
const networkErrorMessages = [
|
||||
"Connection refused",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/react",
|
||||
"version": "0.8.12",
|
||||
"version": "0.8.13",
|
||||
"description": "Convenient library to display typebots on your React app",
|
||||
"license": "FSL-1.1-ALv2",
|
||||
"type": "module",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user